CHRIS RAE'S VBA PAGES
|Description:||Get the user's network login name. Works with both Novell and Microsoft networking under NT 3.51, NT4, Win95, Win98 and Win2000. Thanks to Wade Jackson at Microsoft for some useful info.|
' By Chris Rae, 14/6/99, 3/9/00.
' This is used by GetUserName() to find the current user's
' name from the API
Declare Function Get_User_Name Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long) As Long
Function GetUserName() As String
Dim lpBuff As String * 25
Get_User_Name lpBuff, 25
GetUserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
You're free to use these routines for anything you want - all I ask is that for commercial use you give me credit somewhere. You may instead want to head back to the index for my Visual Basic for Applications Pages or the main routines archive page.