Set objXL = CreateObject("Excel.Application"
objXL.Visible = True
intRow = 1
intColumn = 1
objXL.Workbooks.Add
Set objOU = GetObject("LDAP://ou=Canada,dc=pcd,dc=NesbittBurns,dc=ca"
objXL.Cells(intRow, intColumn).Value = "Canada"
LdapSearch objOU
Function LdapSearch ( objLDAPloc )
Dim objADObject
For Each objADObject in objLDAPloc
Select case objADObject.Class
case "organizationalUnit"
LDAPsearch (objADObject) 'Recurse
case "computer"
set OUPnt = GetObject(objADObject.Parent)
intColumn = 1
objXL.Cells(intRow, intColumn).Value = _
Right(OUPnt.Name, Len(OUPnt.Name) - 3)
intColumn = intColumn + 1
objXL.Cells(intRow, intColumn).Value = objADObject.CN
intRow = intRow + 1
End Select
Next
End Function
objXL.Visible = True
intRow = 1
intColumn = 1
objXL.Workbooks.Add
Set objOU = GetObject("LDAP://ou=Canada,dc=pcd,dc=NesbittBurns,dc=ca"
objXL.Cells(intRow, intColumn).Value = "Canada"
LdapSearch objOU
Function LdapSearch ( objLDAPloc )
Dim objADObject
For Each objADObject in objLDAPloc
Select case objADObject.Class
case "organizationalUnit"
LDAPsearch (objADObject) 'Recurse
case "computer"
set OUPnt = GetObject(objADObject.Parent)
intColumn = 1
objXL.Cells(intRow, intColumn).Value = _
Right(OUPnt.Name, Len(OUPnt.Name) - 3)
intColumn = intColumn + 1
objXL.Cells(intRow, intColumn).Value = objADObject.CN
intRow = intRow + 1
End Select
Next
End Function