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

NT user names in VBA 3

Status
Not open for further replies.

Waiman

Programmer
Sep 11, 2001
15
0
0
GB
Is it possible to find out what NT user name is currently editing a word doc? I need this for version control and approval cycle reasons.

So far I think it can't be done unless you use a custom com object.

Can anyone shed some light on this?
Any help appreciated.
 
I got this code from the help. It may be of some use:

Dim EnvString, Indx, Msg, PathLen ' Declare variables.
Indx = 1 ' Initialize index to 1.
Do
EnvString = Environ(Indx) ' Get environment
' variable.
If Left(EnvString, 5) = "PATH=" Then ' Check PATH entry.
PathLen = Len(Environ("PATH")) ' Get length.
Msg = "PATH entry = " & Indx & " and length = " & PathLen
Exit Do
Else
Indx = Indx + 1 ' Not PATH entry,
End If ' so increment.
Loop Until EnvString = ""
If PathLen > 0 Then
MsgBox Msg ' Display message.
Else
MsgBox "No PATH environment variable exists."
End If

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top