userName

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Control Panel > System = Registered to Ronald L. Lastname
In Excel, Tools > Options > General = User name: Ronald L. Lastname

Function USER()
USER = Application.UserName
= Ronald L. Lastname

End Function
Function USER2()
USER2 = Environ("UserName")
= Ron Lastname

End Function

Any help on what is going on would be appreciated.
Thanks
 
Hi Ronbo,

I believe that Environ("UserName") returns the Windows logon name which is
not necessarily the same as the > Control Panel > System = Registered to
"name." or the Excel name.
 
Sorry for being unclear. What you said is exactly what I have learned. When
I check the Windows logon name by:
Control Panel > System; it = registered to Ronald L. Lastname

Yet when I use ;
Environ("UserName")
It returns - Ron Lastname

Why??

Thanks for your help.
Ronbo
 
Control panel is telling you what name the person used that installed Windows.
On a multi-user system, that could very well be a different person than the
current user. Even if there's only one user, that person can set up his
Windows account using a different name that he used when installing Windows.
 
Its not a multi user system. So what is, Environ("UserName") really
returning, where does it find it and how can I check it?
 
You have already been told, Environ ("Username") returns the login name.
Only the system administrators control what is used here, the users do not,
whereas the value in Excel Tools>Options can be changed by that user. The
Excel value was useful when the systems didn't login, like Win95, but is not
of much use nowadays that I can see.
 
I don't know what you are trying to accomplish, but I often use:
Application.UserName

This return the user name of the application (In this case, excel).

Sometimes I only want macros to trigger for certain users and this is how I
set it up. Of course, you have to have them go, in excel, to tools > options
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top