Vba - Log in user name

A

ajliaks

Hi all,

if I use:

application.username, I get the "Computers name"

how can I get the actual logged in user in the network?
something like:
application.currentlogin ??


I also need to know if there is any posibility that more than 1 use
can input data into the same excel file on the same time?

Thanks in advance.
Aldo
 
H

Haldun Alay

Hi,

following code will help you.

http://www.dicks-blog.com/excel/2004/06/get_the_usernam.html


Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long) As Long

Function GetUserName() As String
Application.Volatile
Dim sBuff As String * 25
Dim lBuffLen As Long
lBuffLen = 25
apiGetUserName sBuff, lBuffLen
GetUserName = Left(sBuff, lBuffLen - 1)
End Function


--
Haldun Alay




"ajliaks >" <<[email protected]>, iletide þunu yazdý Hi all,

if I use:

application.username, I get the "Computers name"

how can I get the actual logged in user in the network?
something like:
application.currentlogin ??


I also need to know if there is any posibility that more than 1 user
can input data into the same excel file on the same time?

Thanks in advance.
Aldo.
 
Top