Posted on August 19, 2011
1
2
3
4
5
6
7
8
9
10
11
12
| 'Controls - How to return an array with all the selected items in a ListBox
Public Function SelectedListItems(lst As ListBox) As String()
Dim I As Long, J As Long
ReDim result(0 To lst.SelCount) As String
For I = 0 To lst.ListCount - 1
If lst.Selected(I) Then
J = J + 1
result(J) = lst.List(I)
End If
Next
SelectedListItems = result
End Function |