Profile.UserName property (Project)
Gets or sets the logon name of the current account profile. Read/write String.
Syntax
expression.UserName
expression A variable that represents a Profile object.
Remarks
The UserName property of the Profile object shows the logon name. By comparison, the UserName property of the Application object shows the local user name.
Example
If there are two account profiles, and the user named Jeff Smith logs on with the DOMAIN\jsmith account, the first statement in the following code shows DOMAIN\jsmith in the Immediate pane of the VBE. The second statement shows Jeff Smith.
Debug.Print Profiles(2).UserName
Debug.Print UserName
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.