Dear All,
I have the below code that extracts user list from AD and displays it in the Immediate Window
My problem is that I am struggling with putting the data in a table instead of displaying it in the Immediate window
Could you please advise?
Many thanks in advance
I have the below code that extracts user list from AD and displays it in the Immediate Window
My problem is that I am struggling with putting the data in a table instead of displaying it in the Immediate window
Could you please advise?
Many thanks in advance
Code:
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 10
objCommand.Properties("Size Limit") = 100
objCommand.CommandText = "<LDAP://EAME/OU=Users,OU=usr,OU=objects,DC=EAME,DC=SYNGENTA,DC=ORG>;(&(objectClass=user)(c=hu));name;subtree"
Set objRecordSet = objCommand.Execute
While Not objRecordSet.EOF
Debug.Print objRecordSet.Fields("Name")
objRecordSet.MoveNext
Wend
objConnection.Close