Posted to microsoft.public.excel.programming
|
|
Getting Computer name and User Name
Sorry i have fout out how
Thanks anyway tom
Alvin
"Alvin Hansen" skrev:
Hi Tom
Is alvin
I have try this but i don't know how to get it to work
Public Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function ReturnUserName() As String
' returns the NT Domain User Name
Dim rString As String * 255, sLen As Long, tString As String
tString = ""
On Error Resume Next
sLen = GetUserName(rString, 255)
sLen = InStr(1, rString, Chr(0))
If sLen 0 Then
tString = Left(rString, sLen - 1)
Else
tString = rString
End If
On Error GoTo 0
ReturnUserName = UCase(Trim(tString))
End Function
How to i call the function and how do i get the username
i believe the username is in Returnusername?
Alvin
"Tom Ogilvy" skrev:
http://www.erlandsendata.no/english/index.php?t=envbaos
--
Regards,
Tom Ogilvy
"Jan G. Thorstensen" wrote in message
...
Getting Computer name and User Name
-----------------------------------------
Is it possible to get the name of the Computer using vba?
(i.e. debug.print computerName) PS.
How can you get the user name from the loged in user in a network
(without using application.username)?
What I want to know is who is the person using my program and
which PC is he or she using.
Thank you for helping.
Jan
|