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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture User information

Status
Not open for further replies.

newbby

Programmer
Mar 16, 2004
36
US
Hello,
Is there a way to capture the user information as found under Ms Word--tools--options--user information. I would then like to use this information elsewhere. Thanks
 
You can capture it with VBA.
Code:
Sub userinfo()
Dim userinfo As String
userinfo = Application.UserInitials & "  " & vbCrLf & _
    Appplication.UserName & vbCrLf & _
    Application.UserAddress
MsgBox userinfo
End Sub

returns a message boc with the initials, a line break, the UserName, then a line break, then the address.

Ovbiously you can arrange this however you like, or pass separate elements into different variables, and - well - do what you like with it.

NOTE however, that the username here is what is in fact in Tools > Options > User Information, and as such can be altered easily by anyone.

If you want to get the actual logon name being used on a specific machine user Environs("UserName").

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top