ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to identify a the user (https://www.excelbanter.com/excel-programming/343932-how-identify-user.html)

Angelo Battistoni

How to identify a the user
 
Hello Helpers!!

What VBA code would you use to identify a the user in windows NT from excel?



Thanks in Advance!!



Gary Keramidas

How to identify a the user
 
try this

Environ("UserName")

--


Gary


"Angelo Battistoni" wrote in message
...
Hello Helpers!!

What VBA code would you use to identify a the user in windows NT from
excel?



Thanks in Advance!!





quartz[_2_]

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!!





All times are GMT +1. The time now is 11:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com