removing multiple list items

spinkung

Registered User.
Local time
Today, 14:42
Joined
Dec 4, 2006
Messages
267
Hey all,

i'm trying to remove some items from a multi-select listbox (value list) using the follwing....

Code:
Set lstBox = Me.lst_To_Address

For Each varItem In lstBox.ItemsSelected
    lstItem = lstBox.Column(0, varItem)
    lstBox.RemoveItem (lstItem)
Next varItem

...however, it only remove the first selected item then exits the loop. Can anyone see why??


Thanks, spin.
 
When you use RemoveItem (n) n = index in your code you are referring to the contents. you should be using

.RemoveItem(varItem)
 
thanks for the reply.


im now using...

Code:
Set lstBox = Me.lst_To_Address

For Each varItem In lstBox.ItemsSelected
    lstBox.RemoveItem (varItem)
Next varItem

..but still having the same problem??
 

Users who are viewing this thread

Back
Top Bottom