Word VBA: Function to get logged in user name
Figured I should follow my post on getting the user name in Excel with a flavor for Word. In the case of Word VBA, much is the same from the API standpoint but instead of a Function, I used a sub routine coupled with a Word varialbe and Field Code. Here it is below:
Sub UserNameWindows()
UserNameWindows = Environ("USERNAME")
End Sub
Sub AddUserNameFieldCode()
Selection.Fields.Add Range:=Selection.Range, Text:="DOCVARIABLE UserNameWindows"
End Sub