tags:

views:

53

answers:

3

How can I programmatically remove all items from a combobox in VBA?

A: 

Psuedo code ahead (updated with actual code):

Do While ComboBox1.ListCount > 0
    ComboBox1.RemoveItem (0)
Loop

Basically, while you have items, remove the first item from the combobox. Once all the items have been removed (count = 0), your box is blank.

Method 2: Even better

ComboBox1.Clear
Tommy
A: 

It's just ComboBox1.Clear I think.

ho1
+1  A: 

You need to remove each one individually unfortunately:

       For i = 1 To ListBox1.ListCount

           'Remove an item from the ListBox.
           ListBox1.RemoveItem 0

       Next i
David Relihan
Worked like a charm, thanks!
Soo