I hope that the difference is clear now. It is easy to confuse the two.
It is easy to change the username in the Excel Application. Anyone using your computer can do it. Do my the menu method as was explained or by code.
e.g. In the Immediate Window of the VBE. Insert your name in place of mine and press Enter key after each line inserted separately:
Code:
Application.UserName="John Doe"
?Application.UserName
Application.UserName="Kenneth Hobson"
?Application.UserName
It is not so easy to do for the Windows username. Basically, you have to add a new user profile for a new Windows username and then log onto that account.
A few easy ways to see your Windows username as given by Environ("username").
1. In the VBE immediate window, type: ?Environ("username"), and press the enter key.
2. Click Start button, Run, and type: %username%, and press Enter key or OK.
3. Start > Run > cmd > OK > Set Username > press Enter key > Exit.
a. If you type, Set, and press Enter key after cmd above, you can see all of the environment variables and values.