Active Directory Export

D

Damian Martin

I'm trying to set up an organisational phonebook in Excel, pulling the
info out of Active directory. I can use a VB Script to do this, but the
user wants to have a button on the spreadsheet to update the info.
Can I call a VBScript from Excel, or how do I convert the VBScript to
VBA? What I've got so far follows..............

Private Sub CommandButton1_Click()

Set objConfiguration =
GetObject("LDAP://OU=Users;OU=Perth;DC=RJV;DC=com;DC=au")

R = 6
For Each objcontainer In objConfiguration
Set fsn = objcontainer.givenname
If objcontainer.ipphone = "x" Then
Else
WriteInfo
End If

Next

End Sub

Sub WriteInfo()
Worksheets("Employee Extensions").Cells(R, 2).Value = fsn

R = R + 1
End Sub
*********************************************************

For clarity I am only importing firstname at the moment. I also have a
check for test accounts and the like. All test accounts have an 'X'
placed in the IPPhone field in Active Directory.
When I run the script, I'm getting a Type Mismatch error.

Thanks for any help or advice.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Top