See if this gets you what you need: paste the following new function into a VB
module:
Option Explicit
'api call for obtaining the username
Private Declare Function GetUserName& Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, _
nSize As Long)
Public Function WindowsUserName() As String
Dim szBuffer As String * 100
Dim lBufferLen As Long
lBufferLen = 100
If CBool(GetUserName(szBuffer, lBufferLen)) Then
WindowsUserName = Left$(szBuffer, lBufferLen - 1)
Else
WindowsUserName = CStr(Empty)
End If
End Function
The above new function returns the username by entering the new function into a
cell:
say cell B2=WindowsUserName( )
I found this cool one at vbaexpress.com