multiselect listbox question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a listbox that is set to simple. I can then select 2 or more records
in the listbox. I have a command button and the on click event:

Application.FollowHyperlink Me!ResultMP3.Column(0)

Which Colum 0 is bound. for example N:\MYMP3S\Can you run.mp3

When I select my command button. It only plays the last selection that I
selected. Is there any way I can hyperlink all that are selected in my
listbox.

Thanks.
 
BrianPaul said:
I have a listbox that is set to simple. I can then select 2 or more
records in the listbox. I have a command button and the on click
event:

Application.FollowHyperlink Me!ResultMP3.Column(0)

Which Colum 0 is bound. for example N:\MYMP3S\Can you run.mp3

When I select my command button. It only plays the last selection
that I selected. Is there any way I can hyperlink all that are
selected in my listbox.

The combo box has an ItemsSelected collection, containing the row
numbers of all the rows that are selected. So you could write something
like this:

Dim varItem As Variant

With Me!ResultMP3
For each varItem In .ItemsSelected
Application.FollowHyperlink .ItemData(varItem)
Next varItem
End With

That's assuming that, as I interpret what you said, the bound column is
the one that contains the path to the .mp3 file to be played.
 
It was close. It worked if I selected the command button 2 time. for
example: I selected 2 MP3's

N:\MYMP3's\fishing in the dark.mp3
N:\MYMP3's\Im alone again.mp3


I selected them both in the listbox and hit the command button with the
pasted code you gave me. It brought up winamp and started playing the first
song. but the second wasn't there. So I hit the button again and it showed
both. So I went another step further and selected another in my listbox and
then the 3rd showed up. So its very close. You may know the solution or I
could try and figure out how to simulate clicking on the button for the
number of records selected in the listbox.

Thanks I know you put me real close when I was ready to give up.
 
Back
Top