hey guys, does anyone know how to find out the username of the currently logged on user? or a site which may have it? any hints/tips/pointers are all welcome! :)
Printable View
hey guys, does anyone know how to find out the username of the currently logged on user? or a site which may have it? any hints/tips/pointers are all welcome! :)
put this in a module, use Username function to retrieve yourself, hehe :)Code:Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function UserName() As String
Dim temp As String
temp = Space(255)
If GetUserName(temp, 255) Then
UserName = Left$(temp, InStr(temp, vbNullChar) - 1)
End If
End Function
Thanks heaps:)