<p>I'm working on a spec for a piece of software for my company and as part of the auditing system I think it would be neat if there was a way to grab the current Active Directory user.</p>

<p>Hopefully something like:</p>

<pre><code>Dim strUser as String
strUser = ActiveDirectory.User()
MsgBox "Welcome back, " &amp; strUser
</code></pre>

Try this article
- I have some code at work that will erm, work if this doesn't...
Relevant quote:
```
```
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
                    (ByVal IpBuffer As String, nSize As Long) As Long
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" _
                    (ByVal lpBuffer As String, nSize As Long) As Long

Function ThisUserName() As String
    Dim LngBufLen As Long
    Dim strUser As String

    strUser = String$(15, " ")
    LngBufLen = 15

    If GetUserName(strUser, LngBufLen) = 1 Then
        ThisUserName = Left(strUser, LngBufLen - 1)
    Else
        ThisUserName = "Unknown"
    End If
End Function

Function ThisComputerID() As String
    Dim LngBufLen As Long
    Dim strUser As String

    strUser = String$(15, " ")
    LngBufLen = 15

    If GetComputerName(strUser, LngBufLen) = 1 Then
        ThisComputerID = Left(strUser, LngBufLen)
    Else
        ThisComputerID = 0
    End If
End Function
```
```