General discussion
Thread display: Collapse - |
All Comments
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
VB API Call & Excel 2000
Declare Function DeclareGetLogin Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function GetUserName() As String
Dim lngLen As Long
Dim strBuf As String
strBuf = Space(255)
lngLen = 255
If CBool(DeclareGetLogin(strBuf, lngLen)) Then
GetUserName = Left$(strBuf, lngLen - 1)
Else
GetUserName = ""
End If
End Function