Hi,
I read a post that is unfortunatly closed. In it PScottC gives me the perfect code I need to populate a list box of OU's with indents. thread931-1474595
Problem I have, is that I need to but the main section into a Function or Sub so I can call it from the onLoad event of an HTA. I originally had the code in a <script> tag in the HTA, so to get arround my issue I put the code into a linked vbs file. The section of my code that builds the Select object can't find object "document".
All I can think of is because the vbs file is linked rather than in the HTA, it is causing it problems finding the select object.
I'd be grateful if anyone could point me in the right direction for putting the code in a function or sub, or fixing the document object problem.
The code where the "object required: document" error occures is shown below. Line 8
Many thanks and many thanks to PScottC for saving many hours of scripting (probably not a good thing!)
Woter
I read a post that is unfortunatly closed. In it PScottC gives me the perfect code I need to populate a list box of OU's with indents. thread931-1474595
Problem I have, is that I need to but the main section into a Function or Sub so I can call it from the onLoad event of an HTA. I originally had the code in a <script> tag in the HTA, so to get arround my issue I put the code into a linked vbs file. The section of my code that builds the Select object can't find object "document".
All I can think of is because the vbs file is linked rather than in the HTA, it is causing it problems finding the select object.
I'd be grateful if anyone could point me in the right direction for putting the code in a function or sub, or fixing the document object problem.
The code where the "object required: document" error occures is shown below. Line 8
Code:
Sub RecurseOUs(ByRef oADOConnection, ByRef oADOCommand, ByVal sSearchRoot, sTab)
Dim oRecordSet, i, objOption, myForm1, TA_OU, document, out
oADOCommand.CommandText = sSearchRoot & ";" & sFilter & ";" & sAttribs & ";" & sScope
Set oRecordSet = oADOCommand.Execute
i= 0
Do Until oRecordSet.EOF
Set objOption = document.createElement("OPTION")
objOption.text = sTab & oRecordSet.Fields("name").Value
objOption.Value = i+1
myForm1.TA_OU.Add(objOption)
'out= sTab & oRecordSet.Fields("name").Value
' MsgBox out
' or perform "stuff" to insert information into HTA
sSearchRoot = "<LDAP://" & oRecordSet.Fields("distinguishedName").Value & ">"
Call RecurseOUs(oADOConnection, oADOCommand, sSearchRoot, sTab & vbTab)
' Move to the next record in the recordset.
oRecordSet.MoveNext
Loop
' Close RecordSet
oRecordSet.Close
End Sub
Many thanks and many thanks to PScottC for saving many hours of scripting (probably not a good thing!)
Woter