'General Declarations on module: Public gsUserID As String Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long Public Sub Main() gsUserID = GetUserID End Sub Public Function GetUserID() As String Dim gunReturn As Long Dim lpBuffer As String * 255 Dim nSize As Long nSize = 255 gunReturn = GetUserName(lpBuffer, nSize) Dim UserName As String UserName = Mid(lpBuffer, 1, nSize - 1) GetUserID = UserName End FunctionNote that Sub Main() has been largely simplified to show only the calling syntax.