multi -selection list boxes

T

Theresa

I am trying to do a multi-selection list box it needs to
be done in VBA. I have never used VBA can anybody help?
Thanks
 
S

SA

Theresa:

What are you trying to do with a multi-select list box? Determine what is
selected? If so here's one way to approach the code:

Dim objCtrl as Control
Dim intCount as Integer, i as Integer
Set objCtrl = Me!MyListBoxControl
intCount = objCtrl.ListCount
For i = 1 to intCount 'Use intCount -1 if you have included row headers
If Ctrl.Selected(i) = True Then
'Do Something
End If
Next i

Another way is similar:

Dim objCtrl As Control
Dim objItem As Variant
Set objCtrl = Me!MyListBoxControl
For Each objItem In objCtrl.ItemsSelected
'Do Something
Next objItem
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top