Hi, I have created a Media player on a userform in the following way.
Using a MP3 Filelister procedure ( available on the web), I populate a sheet with all the details from a music folder containing the tracks. Then I open a userform that creates a playlist for WMP, by looping through the column containing the individual paths of the tracks and when done, plays them. I also created a Listbox that lists the tracks (using a named range formula).
Since the Playlist always starts from the beginning, I would like to be able to "Double Click" on a track and have WMP play from that location on.
Is there a way to get the playlist reordered, so that all track above selected track are removed from playlist? thereby my selection becomes the first song of said Playlist?
code for playing selection;
Private Sub cmdPlay_Click()
Dim Text1 As String
Dim NewFile As Variant
Dim Playlist As IWMPPlaylist
Set Playlist = WindowsMediaPlayer1.newPlaylist("MyNewPlayList", "")
Range("J2").Select
WindowsMediaPlayer1.playlistCollection.getByName ("MyNewPlaylist")
WindowsMediaPlayer1.currentPlaylist.Clear
Do While Not IsEmpty(ActiveCell)
Text1 = ActiveCell.Value
'NewFile = WindowsMediaPlayer1.newMedia(Text1)
Set NewFile = WindowsMediaPlayer1.mediaCollection.Add(Text1)
WindowsMediaPlayer1.currentPlaylist.insertItem (WindowsMediaPlayer1.currentPlaylist.Count), NewFile
Selection.Offset(1, 0).Select
Loop
'the playlist is created, play it
WindowsMediaPlayer1.Controls.Play
End Sub
Using a MP3 Filelister procedure ( available on the web), I populate a sheet with all the details from a music folder containing the tracks. Then I open a userform that creates a playlist for WMP, by looping through the column containing the individual paths of the tracks and when done, plays them. I also created a Listbox that lists the tracks (using a named range formula).
Since the Playlist always starts from the beginning, I would like to be able to "Double Click" on a track and have WMP play from that location on.
Is there a way to get the playlist reordered, so that all track above selected track are removed from playlist? thereby my selection becomes the first song of said Playlist?
code for playing selection;
Private Sub cmdPlay_Click()
Dim Text1 As String
Dim NewFile As Variant
Dim Playlist As IWMPPlaylist
Set Playlist = WindowsMediaPlayer1.newPlaylist("MyNewPlayList", "")
Range("J2").Select
WindowsMediaPlayer1.playlistCollection.getByName ("MyNewPlaylist")
WindowsMediaPlayer1.currentPlaylist.Clear
Do While Not IsEmpty(ActiveCell)
Text1 = ActiveCell.Value
'NewFile = WindowsMediaPlayer1.newMedia(Text1)
Set NewFile = WindowsMediaPlayer1.mediaCollection.Add(Text1)
WindowsMediaPlayer1.currentPlaylist.insertItem (WindowsMediaPlayer1.currentPlaylist.Count), NewFile
Selection.Offset(1, 0).Select
Loop
'the playlist is created, play it
WindowsMediaPlayer1.Controls.Play
End Sub