I'm trying to make it easy for a user to select all in a listbox.
This code works great for clearing all selections (lboTPromoID.Selected(varItem) = False). Why doesn't it work to select all when (varItem) = True?
Also, how can I accomplish my goal here?
Private Sub cmdSelectAll_Click()
On Error GoTo Err_cmdSelectAll_Click
'set a select all command here
Dim varItem
For Each varItem In lboTPromoID.ItemsSelected
lboTPromoID.Selected(varItem) = True
Next varItem
Exit_cmdSelectAll_Click:
Exit Sub
Err_cmdSelectAll_Click:
MsgBox Err.Description
Resume Exit_cmdSelectAll_Click
End Sub
TIA,
Melanie
This code works great for clearing all selections (lboTPromoID.Selected(varItem) = False). Why doesn't it work to select all when (varItem) = True?
Also, how can I accomplish my goal here?
Private Sub cmdSelectAll_Click()
On Error GoTo Err_cmdSelectAll_Click
'set a select all command here
Dim varItem
For Each varItem In lboTPromoID.ItemsSelected
lboTPromoID.Selected(varItem) = True
Next varItem
Exit_cmdSelectAll_Click:
Exit Sub
Err_cmdSelectAll_Click:
MsgBox Err.Description
Resume Exit_cmdSelectAll_Click
End Sub
TIA,
Melanie