Media Player versus Windows Media Player

T

teepee

May I beg for advice from the collective wisdom?

Any advice gratefully received.

I was using media player (v6.4) as an object in a userform and I tried to
use the more advanced version of media player (WindowsMediaPlayer1) that
comes from the additional controls toolbox.

I dutifully replaced all theoccurences of MP with WindowsMediaPlayer1 in
the code, but the command "WindowsMediaPlayer1.Open (Mfile)" generates an
error whereas the command "MP.Open (Mfile)" didn't. Anyone know why?

Old code reads

Private Sub CommandButton1_Click()
Dim Mfile As String
Mfile = "c:\test.mpg"
MP.Open (Mfile)
End Sub

New code reads

Private Sub CommandButton1_Click()
Dim Mfile As String
Mfile = "c:\test.mpg"
WindowsMediaPlayer1.Open (Mfile)
End Sub
 
M

michelxld

Hello

you may try


Private Sub CommandButton1_Click()
WindowsMediaPlayer1.URL = "C:\myMusic.mp3"
WindowsMediaPlayer1.Controls.Play
End Sub


Regards ,
michel
 
T

teepee

"michelxld" wrote
you may try


Private Sub CommandButton1_Click()
WindowsMediaPlayer1.URL = "C:\myMusic.mp3"
WindowsMediaPlayer1.Controls.Play
End Sub

Many thanks. That worked a treat. My only problem is that another command
in the script "MP.Duration" cannot be translated into
"WindowsMediaPlayer1.Controls.Duration" Other than that glitch, I'm most
grateful to you.

tp
 
M

michelxld

Hello

try this macro

WindowsMediaPlayer1.currentMedia.duration

or

Dim ValMin As Double, ValSec As Double, S As Double
S = WindowsMediaPlayer1.currentMedia.duration
ValMin = Application.WorksheetFunction.RoundDown((S / 60), 0)
ValSec = Application.WorksheetFunction.RoundDown(S, 0) - (ValMin * 60)
MsgBox Format(ValMin, "00") & ":" & Format(ValSec, "00")


regards ,
michel
 
T

teepee

michelxld said:
Hello

try this macro

WindowsMediaPlayer1.currentMedia.duration

or

Dim ValMin As Double, ValSec As Double, S As Double
S = WindowsMediaPlayer1.currentMedia.duration
ValMin = Application.WorksheetFunction.RoundDown((S / 60), 0)
ValSec = Application.WorksheetFunction.RoundDown(S, 0) - (ValMin * 60)
MsgBox Format(ValMin, "00") & ":" & Format(ValSec, "00")

Thank you. I will try it and let you know how it went

tp
 
T

teepee

Thanks. That also worked.

Last one...

Private Sub MP_PositionChange(ByVal oldPosition As Double, ByVal newPosition
As Double)
Application.Cells(1, 1) = newPosition
End Sub

Needs to go to WindowsMediaPlayer. And need to reference worksheet sheet
'results' rather than the same sheet.

Any idea?
 

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