Object library feature not supported....

G

Guest

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

The spread sheet has been bounced back and forth between 2 PC's
The 2nd line gets the error.
This same exact code worked well for 4 weeks while I tweaked and played with
the code between two different PCs.

PC#1 = Office2002 with WMP version 10 loaded.
PC#2 = Office2003 with WMP version 9 loaded.

for several weeks I was playing with the code between the 2 PCs and the
Create Object code worked with out any glitches (the code grew to encompass
both media.collection and current.media objects being referenced)

then when i finally got .getItemInfo working on PC#2... I swapped to PC#1
(just like I had been doing with out any problems)

This error (Compile error: Object library feature not supported) occured on
PC#1. I looked at the "References" tab, but "Windows Media Player" object
model was still loaded. I rebooted PC#1 and then the code started to work
(no changes). I continued to work on changing the code and it continued to
work. Saved my work and tried to swap again...

PC#2 now gets this error and it is using the "exact" code that worked
before. Checked References and the object model for WMP seems to be loaded
properly. I tried rebooting, but the error persists.

Why am I getting this error?
What are the exact requirements for references that should be loaded?

Currently on PC#2 the following References are checked:
Visual Basic For Applications
Microsoft Excel 10.0 Object Library
OLE Automation
Microsoft Office 10.0 Object Library
Windows Media Player ( the one pointing to wmp.dll)
Microsoft VBScript Regular Expressions 1.0
Microsoft VBScript Regular Expressions 5.5
Windows Media Player (the one pointing to msdxm.ocx)
Windows Script Host Object Model
Windows Media Player Compatibility Layer

I cant get to PC#1 to see what is selected on it, but the wmp.dll one is
selected I know from memory. (will add PC#1's list later when I can get to
it)

*** Code listed below ***
the line causing the error has not been changed in 4 weeks of tinkering with
this and only in the last 2 days has the error been occuring.
********************
Sub Test3()
Dim Wmp As WindowsMediaPlayer
Set Wmp = CreateObject("WMPlayer.OCX.7")
Wmp.Controls.stop

Set mc = Wmp.mediaCollection.getAll
MediaCount = mc.Count - 1
Dim Atts(), AtVal() As String
Set oPut = Range("D2").Cells
K = 0
For I = 0 To MediaCount
Application.StatusBar = "Processing " & I & " of " & MediaCount & "
media items"
Set curMedia = Wmp.mediaCollection.getAll.Item(I)
URL = curMedia.sourceURL

'this starts playback..
Wmp.currentMedia = curMedia

If Left(URL, 62) = "D:\Documents and Settings\John M. Keith\My
Documents\My Music\" Then
At_Count = Wmp.currentMedia.attributeCount
ReDim Atts(At_Count - 1), AtVal(At_Count - 1) As String
For J = 0 To At_Count - 1
Atts(J) = Wmp.currentMedia.getAttributeName(J)
AtVal(J) = Wmp.currentMedia.getItemInfo(Atts(J))
Col = 99
Select Case Atts(J)
Case "Author"
Col = 0
Case "WM/AlbumTitle"
Col = 1
Case "WM/TrackNumber"
Col = 2
Case "Title"
Col = 3
Case "Duration"
Col = 4
Case "ReleaseDate"
Col = 5
Case "WM/Composer"
Col = 6
Case "WM/Genre"
Col = 7
Case "WM/Provider"
Col = 8
Case "FileSize"
Col = 9
Case "AcquisitionTime"
Col = 10
Case "FileType"
Col = 11
Case "SourceURL"
Col = 12
End Select
If Col <> 99 Then
oPut.Offset(K, Col).Value = AtVal(J)
' Wmp.currentMedia.setItemInfo("Author", "Test") = "Test"
End If
Next J
K = K + 1
End If
'this stops playback
Wmp.Controls.stop
Next I
Application.StatusBar = False
End Sub
 
G

Guest

I got it working again...
I had to uncheck the WindowsMediaPlayer Reference, save, then re-check the
reference. Then the "CreateObject" line started working again.

It appears that the object model loaded as a result of the software
version(s) i'm running gets stored with the workbook, so each time I swap to
the different PC, I have to reload the object model reference.

Can anyone verify that is what is happening?
Also, Which version of which software is the one causing this? (Office2003
vs. Office2002 OR WMP 9 vs. WMP 10) or both?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top