VB list box how to obtain text in selected rows ?

  • Thread starter Thread starter wojjed
  • Start date Start date
W

wojjed

Hi

Here's how i fill the list :

Private Sub CommandButton1_Click()

Dim sFilename As Variant

sFilename = Application.GetOpenFilename("Excel files (*.xls; *.csv),
*.xls; *.csv", 0, "Wybierz pliki", 0, True)

For Y = 1 To UBound(sFilename)
ListBox1.AddItem (sFilename(Y))
Next

End Sub

When files are selected i want to open them using Workbooks.Open
(sFilename(Y)) - but in loop that method doesnt work - why ? And how
to obtain text in selected rows ? Supose i have
Private Sub CommandButton2_Click() in which i want to open selected
files - how to do it ?


thx for all sugestions
 
Are you sure you are posting in the right group?

????Dim sFilename as Variant?????
Sounds like VB6 to me, in which case look at the ListBox.Selected(index)
property.

If .Net, look at ListBox.SelectedItems property.
 
Back
Top