I'm not sure about "active directory", but here is a routine I use frequently.
Brad
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function GetNetworkUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
GetNetworkUserName = Left$(strUserName, lngLen - 1)
Else
GetNetworkUserName = ""
End If
'MsgBox "User name is: " & GetNetworkUserName
End Function