Mega Code Archive

 
Categories / VisualBasic Script / Forms
 

Get the selected items in a ListBox

Private Sub OKButton_Click()       Dim Msg As String       Dim i As Integer       Msg = "You selected" & vbNewLine       For i = 0 To ListBox1.ListCount - 1           If ListBox1.Selected(i) Then               Msg = Msg & ListBox1.List(i) & vbNewLine           End If       Next i       MsgBox Msg       Unload UserForm1   End Sub