views:

49

answers:

1

Hi,

I am trying to create a new user in ActiveDirectory with the following code:

Sub CTRL1_12_OnClick(eventObj)
 Set objOU = GetObject("LDAP://OU=Users,dc=mfcvt,dc=local")
 Set objUser = objOU.Create("User", "cn=MyerKen")
 objUser.Put "sAMAccountName", "myerken"
 objUser.SetInfo
End Sub

This code is set to run from Infopath when I click on button CTRL1_12. But when I do run it all I get is this error:

Infopath cannot complete this action, because of an error in the form's code.    
The following error occurred:

        ActiveX component can't create object: 'GetObject'
        File:script.vbs
        Line:20

Thanks for looking

Peter