Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Vbscript and HTA: when using option explicit, populating a select combo box from a text file fails

$
0
0

Hi... I've got a handle on this except if I use the 'option explicit' setting.

So even though this works :

Sub LoadClass
strNewFile = "classes.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile _
(strNewFile, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Set objOption = Document.createElement("OPTION")
objOption.Text = strLine
objOption.Value = strLine
className.Add(objOption)
Loop
objFile.Close
End sub
{select size="1" name="className"}

It doesn't work when explicit is on. even though I Dim all of the variables I get

"Object Required 'className' error

What I don't know is what type of object to create so that I can set option explicit.

I have tried array, collection, and dictionary.

I have done numerous searches via google and bing.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>