Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Get username into Excel

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,3603
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Get username into Excel
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Get username into Excel - 7/1/2005 3:05:02 AM   
  hobojester

 

Posts: 3
Score: 0
Joined: 7/1/2005
From:
Status: offline
Disclaimer: TOTAL NEWBIE

I'm working with Excel macros and I'd like to have a snippet of code that will import the current username into a cell. Make sense? Thanks for your help!
 
 
Post #: 1
 
 Re: Get username into Excel - 7/1/2005 3:12:53 AM   
  ehvbs

 

Posts: 2220
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
This works for me:

      

(in reply to hobojester)
 
 
Post #: 2
 
 Re: Get username into Excel - 7/1/2005 3:51:05 AM   
  hobojester

 

Posts: 3
Score: 0
Joined: 7/1/2005
From:
Status: offline
Awesome, thanks for the help.

I've imported this into a macro and ran it, but when I run it it appears that nothing happens. Can you help me troubleshoot? I get no errors.

(in reply to hobojester)
 
 
Post #: 3
 
 Re: Get username into Excel - 7/1/2005 4:04:50 AM   
  ehvbs

 

Posts: 2220
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
I started Excel. I pressed Alt+F11 to get into the VBE editor. I inserted a new module and
entered the code. I put the cursor into Sub test() and pressed F8 to step thru. When the
line cursor reached "End Sub", there was my username in Debug window ("Direktfenster").

If you do the same, we may determine, what went wrong.

I'm not sure what you mean by "import into a macro".

(in reply to hobojester)
 
 
Post #: 4
 
 Re: Get username into Excel - 7/1/2005 4:18:12 AM   
  hobojester

 

Posts: 3
Score: 0
Joined: 7/1/2005
From:
Status: offline
Thanks for the clarification on that. I basically got to where you did via this macro stuff, but I like your way better.

*Update*
Ah, I needed to add one thing:

ActiveCell.Value = sUserName

You gave me everything I needed to get the username into a variable, I was just missing putting the variable out into the spreadsheet. Thanks for your help, this is exactly what I needed (see, I'm a total newbie, but somehow I figured out how to put it out to teh screen :)). Thanks again for your help.

(in reply to hobojester)
 
 
Post #: 5
 
 Re: Get username into Excel - 7/1/2005 4:28:03 AM   
  ehvbs

 

Posts: 2220
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Don't mention it; I'am glad to help you. I should have written sUserName
into a Cell in my code, but I always have to think a least three times how
to specify a Cell in Excel. Why I didn't use Msgbox (or was it MessageBox?)
is beyond me.

(in reply to hobojester)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Get username into Excel Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts