title: Multi selection listbox vba
body: <p>I have some listboxes in a form with multi selection allowed. I need to associate the options selected to variables.
  I tried this:</p>
  
  <pre><code>For i = 0 To (ListBox7.Items.Count - 1)
              If ListBox7.Selected(i) = True Then
                  If maq1 = "" Then
                      maq1 = ListBox7.GetItemText(i)
                  Else
                      maq2 = ListBox7.GetItemText(i)
                  End If
              End If
  Next
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>For i = 0 To (ListBox7.Items.Count - 1)
              If ListBox7.SelectedItem(i) Then
                  If maq1 = "" Then
                      maq1 = ListBox7.GetItemText(i)
                  Else
                      maq2 = ListBox7.GetItemText(i)
                  End If
              End If
  Next
  </code></pre>
  
  <p>But nothing is working. In the first case, i got an error "selected is not a member of listbox" and in the second one i got "the conversion of type 'Char' to 'Boolean' is not valid".
  does anyone can help me? thanks :)</p>