NETKILLER Posted September 2, 2011 Report Posted September 2, 2011 hi all I am working on making a list box in HTA making a manual list box is fine, making the list box that builds it self again fine but what I am trying to do is list all files in a folder and then use that info in the list box. this is what i have at this point My HTML application APPLICATIONNAME="My HTML application" ID="MyHTMLapplication" VERSION="1.0"/> Sub Window_OnLoad Dim FolderPath 'folder to be searched for files Dim objFSO Dim objFolder Dim colFiles Dim objFile Dim objOption FolderPath = "\\server\installscripts$" Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(FolderPath) Set colFiles = objFolder.Files For Each objFile in colFiles Set objOption = objFile.Name objOption.text = objFile.Name objOption.Value = objFile.Name mylistbox.Add(objOption) Next End Sub the error i am getting is thank you
Steve21 Posted September 2, 2011 Report Posted September 2, 2011 Set objOption = objFile.Name objOption.text = objFile.Name objOption.Value = objFile.Name Why? If all you want is to add the name to it, you won't even need objects as such. Steve
NETKILLER Posted September 2, 2011 Author Report Posted September 2, 2011 hey all I have fixed it. replace the for each with the following For Each objFile in colFiles Set objOption = Document.createElement("OPTION") objOption.Text = objFile.Name objOption.Value = objFile.Name mylistbox.Add(objOption) Next hope this helps some one and thank you for your reply Steve21
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now