How to identify a the user
You may wish to try any or all of the following which return different bits
of info as labeled:
Public Function ReturnUserName() As String
'RETURN THE USER NAME AS RECORDED IN [TOOLS][OPTIONS][GENERAL]
ReturnUserName = Application.UserName
End Function
Public Function ReturnNetworkName() As String
'RETURNS NETWORK LOGIN ID OF CURRENT USER
ReturnNetworkName = Environ("UserName")
End Function
Public Function ReturnComputerName() As String
'RETURNS COMPUTER NUMBER USER IS ON
ReturnComputerName = Environ("ComputerName")
End Function
Use these like this example:
Dim sUser as String
sUser = ReturnNetworkName
Msgbox sUser
HTH.
"Angelo Battistoni" wrote:
Hello Helpers!!
What VBA code would you use to identify a the user in windows NT from excel?
Thanks in Advance!!
|