On 2002-08-23 18:04, Joe Was wrote:
Ivan,
Yes you are right, the right-click-view-code object properties did give me the full list of properties. I add the controle properties I needed. I should have known it would work just like any other control!
I am still having a problem with loading variables for the control properties in a standard module:
Sub myWAV()
MediaPlayer1.Open (mySound)
MediaPlayer1.PlayCount = myExtra
End Sub
Where mySound and myExtra are passed variables.
I tried the "MediaPlayer.MediaPlayer1" object it crashes,
if I only use "MediaPlayer1" I error out: Object required? JSW
Hi Joe,
because the MediaPlayer is an embeded
object in the Worksheet, hence the
underlying code in the Worksheets Code Module, the Object is not available to any
other Module, it is Private to the worksheet
code module.
So if you are working from a STD Module you will need to reference the MediaPlayers Class Interface = IMediaPlayer
So this is how it would look;<PRE><FONT color=blue>Option Explicit</FONT><FONT color=#339966>'//</FONT><FONT color=#339966>'// Joe you need to reference it as below</FONT><FONT color=#339966>'// This is how I would do it.</FONT><FONT color=#339966>'//</FONT><FONT color=blue>Dim</FONT>objMP<FONT color=blue>As</FONT> MediaPlayer.IMediaPlayer<FONT color=blue>Sub</FONT>InitializeMediaPlayer()<FONT color=blue>If</FONT>objMP Is<FONT color=blue> Nothing</FONT><FONT color=blue> Then</FONT><FONT color=blue>Set</FONT>objMP = ActiveSheet.OLEObjects("MediaPlayer1").Object<FONT color=#339966> '// OR if OLEObject on another sheet say Sheet2 (Code name) then</FONT><FONT color=#339966> 'If objMP Is Nothing Then Set objMP = Sheet2.OLEObjects("MediaPlayer1").Object</FONT><FONT color=blue>End Sub</FONT><FONT color=blue>Sub</FONT>PlaySnd()
InitializeMediaPlayer
objMP.<FONT color=blue>Open</FONT>("C:WINDOWSMEDIABach's Brandenburg Concerto No. 3.rmi")<FONT color=blue>End Sub</FONT><FONT color=blue>Sub</FONT>StopSnd()
InitializeMediaPlayer
objMP.Stop<FONT color=blue>End Sub</FONT></PRE>
_________________
Kind Regards,<font size=+2><font color="red"> I<font color="blue">van<font color="red"> F M</font color="blue">oala</font><font size=1> From the City of Sails
This message was edited by Ivan F Moala on 2002-08-23 19:21