List box Selection

B

bigbore50

I have a question about a list box

Say i have a list box named

  • And when i click a button i want it to set STRdocument to the selected
    document in
    the list box. What would the code look like

    I tried this but it doesn't want to run

    Private Sub Command4_Click()
    Dim I As Integer
    Dim Index(1 To 20) As Double
    Dim StrDocument(1 To 20) As String
    If List.Selected(List.ListIndex) = true Then
    Index(I) = List.ListIndex
    StrDocument(I) = List(List.ListIndex)
    I = I + 1
    End If
    End Sub

    What could be wrong
 
Top