J
Jreg
Hi there;
I am trying to create an Excel document that is populated with the most
recent list of employees downloaded from our local Active Directory Server.
The following is some sample code that was used in Access to draw a field
from AD into Access. I want to know how to do something simlar to this in
which I can pull the a certain field (such as lastname) from the AD user list
and have it list them all in Excel.
cboAssignedTo.AddItem "Available"
'Get available users
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"
Set rs = New ADODB.Recordset
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.Open
"<LDAP://roaadsrv1.meridium.com/OU=UsersOU,DC=meridium,DC=com>;(objectClass=user);cn;subtree", conn, adOpenStatic, adLockReadOnly
rs.Sort = "cn"
While Not rs.EOF
cboAssignedTo.AddItem ("""" & rs.Fields(0).Value & """")
rs.MoveNext
Wend
conn.Close
Any help is appreciated
Jreg
I am trying to create an Excel document that is populated with the most
recent list of employees downloaded from our local Active Directory Server.
The following is some sample code that was used in Access to draw a field
from AD into Access. I want to know how to do something simlar to this in
which I can pull the a certain field (such as lastname) from the AD user list
and have it list them all in Excel.
cboAssignedTo.AddItem "Available"
'Get available users
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set conn = New ADODB.Connection
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"
Set rs = New ADODB.Recordset
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.Open
"<LDAP://roaadsrv1.meridium.com/OU=UsersOU,DC=meridium,DC=com>;(objectClass=user);cn;subtree", conn, adOpenStatic, adLockReadOnly
rs.Sort = "cn"
While Not rs.EOF
cboAssignedTo.AddItem ("""" & rs.Fields(0).Value & """")
rs.MoveNext
Wend
conn.Close
Any help is appreciated
Jreg