Here is the code for review:
Private Sub ListBox1_Click()
Dim i As Integer, iNumberSelected As Integer
'Create an array to hold the selected items.
ReDim sSelection(1 To ActiveDialog.Evaluate("ListBox1").ListCount) As
Single
With ActiveDialog.ListBoxes("ListBox1").List = Array("CSE", "LAW")
'Add item to sSelection if its item is True
For i = 1 To ActiveDialog.Evaluate("ListBox1").ListCount
If ActiveDialog.Evaluate("ListBox1").Selected(i) = True Then
'Add the item to sSelection.
sSelection(iNumberSelected) =
ActiveDialog.Evaluate("ListBox1").List(i)
End If
Next i
If iNumberSelected <> 0 Then
'Trim off elements not used.
ReDim Preserve sSelection(iNumberSelected)
'Return an array containing the selected item.
vSelection = sSelection
Else
'Return False if no items were selected.
vSelection = False
End If
End With
End Sub