Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use VBA in excel to obtain the username of the user currently logged i

Status
Not open for further replies.

simdan42

Programmer
Jul 17, 2002
118
US
How can I access or Obtain the Windows username of the current user loggedinto windows. I want to capture that info and enter it into a text openwhen the workbook opens.
 
hi
try using Environ("Username")

;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
shaggi - that will only give what is entered in Tools>Options>General>Username - easily changed and not necessarily the same as the logon ID
There is also an API call to do this but if environ("username") works for you, there is no point 'cos it's much more code (well, about 15 lines anyway)

Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
environ("username") worked great thankyou!
 
xlbo's Man Yoo and you're Chelsea?

What a poor show.

Blackburn Rovers for me. Maybe I should put it in my profile?

 
xlbo,
you are absolutely right, but what is all this man yoo stuff, r u from up here (manc)???
 
Livin' in Nottingham at the mo and working in Burton (marmite smell) on Trent but yeh, was born n bred in Mancland - Sale to be exact

Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
Has part of this thread disappeared?
I'm sure I posted something about the diff between using environ and app. The first of the threads I DIDN'T copy from xlbo yesterday!!!

Bryan, I take it you were referring to me? So ok, blackbum won down here but what else have they done (apart from more silverware than us in the last two years, I'll get me coat!)

Why are there so many people from Lancashire in this forum? Are there many jobs up there?

;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
Nope - that's why I moved to Notts.....and yes, I think part of this thread has gone - probably 'cos it's got a bit off topic

Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top