Page 1 of 1

How to empty a drop-down list?

Posted: Wed Mar 23, 2011 8:34 pm
by hackoo
Hi I have this HTA "Drop Down Menu From File" I wonder if there is any methods or a Trick to empty my drop-down list?

Code: Select all

Source For Drop Down Menu From File 
'--==--==[ VBScript Source ]==--==-- 
Sub Window_Onload 
    ForReading = 1 
    strNewFile = "Phrases.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 
        AvailablePhrases.Add(objOption) 
    Loop 
    objFile.Close 
End Sub 
Sub onthefly 
    Selection = AvailablePhrases.Value 
MsgBox "You Selected:" & VBCRLF & Selection, 64,"On-The-Fly List Box" 
End Sub 'onthefly 
Sub OpenPhrases 
ShellRun = objShell.Run ("%comspec% /c Start Notepad Phrases.txt", 0, 1) 
End Sub 
--==--==[ HTML Source ]==--==-- 
Drop Down Menu From File
 
 
   
 
 
hackoo2011-03-24 03:37:38

How to empty a drop-down list?

Posted: Thu Mar 24, 2011 1:48 am
by jvierra

Code: Select all

For i = 0 To mylist.options.length
mylist.options.remove 0
Next
http://msdn.microsoft.com/en-us/library ... S.85).aspx