ClulessChris
IS-IT--Management
Hi,
I'm trying to convert a VBA Routine to VBS. So far I have:
So far i'm geting the error Object Required: "
on the line:
I don't see why I'm geting this error.
Never knock on Death's door: ring the bell and run away! Death really hates that!
I'm trying to convert a VBA Routine to VBS. So far I have:
Code:
Dim Conn
Dim Rs
Dim propList
Dim propEntry
Dim propVal
Dim V
Dim sQuery, sRtn
Dim sBase, sFilter
Dim sResult
sBase = "<LDAP://x500.inrev.gov.uk/o=inland revenue,c=gb>"
sFilter = "(&(objectClass=person)(CN=6021134))"
sQuery = sBase & ";" & sFilter & ";ADsPath;SubTree"
Conn = CreateObject("ADODB.Connection")
Conn.Open "Data Source=Active Directory Provider;Provider=ADsDSOObject"
Set Rs = Conn.Execute(sQuery)
If Rs.EOF = False Then
Set propList = GetObject(Rs("ADsPath"))
propList.GetInfo
Set propEntry = propList.GetPropertyItem("irhomeorganizationalunit", ADSTYPE_CASE_IGNORE_STRING)
For Each V In propEntry.Values
Set propVal = V
Select Case propVal.ADsType
Case ADSTYPE_CASE_EXACT_STRING
sRtn = propVal.CaseExactString
Case ADSTYPE_CASE_IGNORE_STRING
sRtn = propVal.CaseIgnoreString
Case Else
sRtn = "Unable to handle a property of type: " & propVal.ADsType
End Select
Next
End If
If Left(sRtn, 6) = "Unable" Then
sResult = sRtn
Else
sResult = Mid(sRtn, 4, InStr(sRtn, ",") - 4)
End If
msgbox sResult
Tidy_up:
If Not Rs Is Nothing Then Rs.Close
If Not Conn Is Nothing Then Conn.Close
Set Rs = Nothing
Set Conn = Nothing
So far i'm geting the error Object Required: "
on the line:
Code:
Conn.Open "Data Source=Active Directory Provider;Provider=ADsDSOObject"
I don't see why I'm geting this error.
Never knock on Death's door: ring the bell and run away! Death really hates that!