Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows media player control remove playlists

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
I have a Windows media player control, named windowsmediaplayer1, on an Access 2003 form. In the code I have Dim WMP as Object (have tried WindowsMediaPlayer with reference to OCX).

I’m trying to remove
1) All playlists
2) Selected playlists (ie ones which I name)

Have tried the following:

Code:
Dim newPlayList As WMPLib.IWMPPlaylist
   Set newPlayList = windowsmediaplayer1.playlistCollection.Remove("MyPlaylist")

But it doesn’t work?
 
Ok, I’ve finally worked out one solution which works for me.

So here it is for anyone who’s interested / working with Windows Media Player control and VBA.

Code:
Dim objPlaylists As WMPLib.IWMPPlaylistCollection
Dim objOldList As WMPLib.IWMPPlaylistArray

Set objPlaylists = WMP.playlistCollection
Set objOldList = objPlaylists.getByName("NameOfPlaylistHere")

objPlaylists.Remove objOldList.item(0)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top