LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Windows Media Player - how to establish references?

Greetings

I have been playing around a little with using VBScript to interact
with Windows Media Player's library.
For example, here is a script that works fine:

'''''''''''''''''''''''''''''''''''''''''''''''''' ''

Set mp = CreateObject("WMPlayer.OCX" )
Set mpColl = mp.MediaCollection
Set songList = mpColl.getByAttribute("MediaType", "Audio")
Set albumDict = CreateObject("Scripting.Dictionary")

For i = 0 to songList.Count - 1
Set song = songList.Item(i)
albumKey = song.getItemInfo("WM/AlbumArtist") & ", " &
song.getItemInfo("Album")
If not albumDict.Exists(albumKey) Then
albumDict.Add albumKey, ""
End If
Next

albumArray = albumDict.Keys
For i = LBound(albumArray) to UBound(AlbumArray)
msg = msg & vbCrLf & albumArray(i)
Next

Msgbox "Albums:" & msg

'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''

I would like to get it to run in VBA , preferably using early bindings
and New rather than the CreateObject approach, but every attempt I've
used to add the proper references to the project (several references
mention Windows Media Player - wmp.dll looks like it *should* work)
always throws an error when I try to instantiate a media player
object. For example, both

Dim mp As WindowsMediaPlayer
Set mp = CreateObject("WMPlayer.OCX")

and

Dim mp As WindowsMediaPlayer
Set mp = New WindowsMediaPlayer

Throws a run-time error (-2147467259 (80004005): Automation Error,
Unspecified Error)

Any idea what is happening here? Solutions? I would be satisifed with
any way to modify the above script to run in VBA.

Thanks in advance

-semiopen

p.s. Ultimately, I would like to create a spreadsheet that tracks what
music I play as a function of time, and would do things like generate
a chart showing how much Bach I listened to month to month over a
specified time period, so wanting to do it in Excel makes sense (even
if it is not a serious app). I could of course write a VBScript to
write the data to an Excel workbook which has macros to generate the
charts, etc. - but it seems unnatural to split the code between 2
files.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Media Player Zaahir Excel Programming 1 November 23rd 06 10:40 PM
Windows Media Player Zaahir Excel Programming 2 November 23rd 06 10:55 AM
stopping Windows Media Player using VBA Malone[_3_] Excel Programming 0 August 30th 06 06:46 AM
Media Player versus Windows Media Player teepee[_4_] Excel Programming 6 October 15th 05 06:16 PM
Media Player versus Windows Media Player teepee Excel Discussion (Misc queries) 1 October 14th 05 02:25 AM


All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"