View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default Getting the User Name

Vergel
Thanks for the help. That works great. Otto
"Vergel Adriano" wrote in message
...
Otto,

Application.UserName returns the user name entered in the General tab of
Options. Try

MsgBox Environ("username")


--
Hope that helps.

Vergel Adriano


"Otto Moehrbach" wrote:

Excel XP & Win XP
I need to get, via VBA, the user name. At least, that's what I thought I
needed. What I really need is the name of the folder under "Documents
and
Settings" that the current user is working in. I thought this was the
user
name.
On my computer, that folder name is my full name, as in First Last.
So
I ran a little one line macro:
MsgBox Application.UserName
That gave me my first name only. Obviously, that line of code is not
looking for the folder name I need that Windows created when I installed
Windows.
Looking through Windows, I see that my user account name is the same as
the
folder name I need
Question: How do I get that 'user account'/folder name via VBA? Thanks
for
your time. Otto