Use LDAP.
Google for VBA and LDAP and y'll get a multitude of options
Here's one example straight from a google search quest (using above key
words)
Krgrds,
Perry
Dim con As ADODB.Connection
Dim com As ADODB.command
Dim rs As ADODB.Recordset
Dim ADsPath As String
ADsPath =
"LDAP://directorydev.domain.com/aid=it0030,ou=Applications,o=domain.com,c=us"
'set the connection
Set con = New ADODB.Connection
With con
.Provider = "ADSDSOObject"
'.Properties("User ID") = "cn=Directory Manager"
',aid=it0030,ou=Applications,o=domain.com,c=us"
'.Properties("Password") = "password"
.Open "ADSI"
End With
'set the command object
Set com = New ADODB.command
With com
.ActiveConnection = con
.CommandText = "<" & ADsPath &
">;(userreferencedn=*xternal*);ADsPath;subtree"
End With
Set rs = com.Execute
If Not (rs.BOF And rs.EOF) Then
rs.MoveLast
rs.MoveFirst
MsgBox rs.RecordCount & "'s Returned"
While Not rs.EOF
MsgBox rs.Fields(0).Value
rs.MoveNext
Wend
End If
con.Close