RE/
How can I capture a user-id?
32-bit Windows ID:
-------------------------
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
Public Function UserIdWindowsGet() As String
debugStackPush mModuleName & ": UserIdWindowsGet"
On Error GoTo UserIdWindowsGet_err
' PURPOSE: To retrieve the Windows UserID of the person currently logged on to
this PC
' RETURNS: UseID or empty string
Dim myBuffer As String * 255
Dim myUserName As String
GetUserName myBuffer, Len(myBuffer) 'Get the
user name
myUserName = Left(Trim(myBuffer), InStr(myBuffer, Chr(0)) - 1) 'Trim excess
characters
If Len(myUserName) > 0 Then
userIdWindowsGet = myUserName
Else
bugAlert True, "Unable to get Windows UserID"
End If
UserIdWindowsGet_xit:
debugStackPop
On Error Resume Next
Exit Function
UserIdWindowsGet_err:
bugAlert True, ""
Resume UserIdWindowsGet_xit
End Function
--
PeteCresswell