From the internet (
www.mrexcel.com) :
Option Explicit
' 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)
End Function
Sub test()
[A1] = GetUserName
End Sub
Daniel
I'm trying to retrieve windows user name or log in name on a excel sheet with
certain commands. But i'm not sure if excel supports this feature.
Currently i'm using MS Office 2003 and WindowsXP professional edition.