Media Player Help

Z

ZipCurs

I have be working to get the Media Player to run small sections of longer
audio and video clips. I am having some success, but have hit a number of
dead ends and was hoping to get some help.

Working in Excel 2007 on an XP machine, the following code works great for
an object using the Media Player (msdxm.ocx) on a UserForm. The object is
not recognized on a Vista machine, and nothing similar can be replaced. Even
though I can see the msdxm.ocx file in the actual directory, this option is
not available under References. What are my options to get this to run on
multiple machines? Can I get the msdxm.ocx version to show up on the
Reference Library with Vista? I can see the commands on the Object Browser
on the Vista machine, I just don't know how to insert a "Media Player"
instead of a "Windows Media Player". Putting the "Media Player" on a
worksheet works on the XP machine until the file is closed. Upon opening, it
crashes Excel and won't run again.

Private Sub TryIt()
'Runs msdxm.ocx ActiveX object on UserForm1. It actually seems to work.
Dim MediaFileName As String
MediaFileName = Range("B2")

Application.EnableEvents = True

Load UserForm1
UserForm1.MediaPlayer1.AutoStart = False
UserForm1.MediaPlayer1.Filename = MediaFileName
UserForm1.MediaPlayer1.ShowTracker = True
UserForm1.MediaPlayer1.ShowStatusBar = True
UserForm1.MediaPlayer1.SelectionStart = Range("B3")
UserForm1.MediaPlayer1.SelectionEnd = Range("B4")
UserForm1.MediaPlayer1.Play
UserForm1.Show
Unload UserForm1
End Sub


Using the ActiveX object which references wmp.dll on a UserForm works on
both the XP and Vista machine. I can set the starting point, but have no
clue how to stop it at the desired point. Is there a way to monitor the
current location of the media playing and stop it? Is there some tricky way
the set SelectionEnd with this object? I am guessing that I will need to
have my own controls to get this to behave.

Sub TryIt()
'Runs wmp.dll ActiveX object on UserForm1. The start sort of works, but
no end.
Dim MyStart As Long
Dim MyEnd As Long
Dim MyStringStart As String
Dim MyFile As String

MyFile = Range("B2")
MyStart = Range("B3")
MyEnd = Range("B4")

Application.EnableEvents = True
Load UserForm1
UserForm1.Caption = "Time 1 - Time 2"
UserForm1.WindowsMediaPlayer1.settings.autoStart = False

UserForm1.WindowsMediaPlayer1.URL = MyFile
UserForm1.WindowsMediaPlayer1.Controls.currentPosition = MyStart
UserForm1.WindowsMediaPlayer1.Controls.Play
UserForm1.Show
Unload UserForm1
End Sub

I am open to other options. Any help is more than appreciated. Thanks
Zipcurs
 
J

Jef Gorbach

I have be working to get the Media Player to run small sections of longer
audio and video clips.  I am having some success, but have hit a numberof
dead ends and was hoping to get some help.

Working in Excel 2007 on an XP machine, the following code works great for
an object using the Media Player (msdxm.ocx) on a UserForm.  The objectis
not recognized on a Vista machine, and nothing similar can be replaced. Even
though I can see the msdxm.ocx file in the actual directory, this option is
not available under References.  What are my options to get this to runon
multiple machines?  Can I get the msdxm.ocx version to show up on the
Reference Library with Vista?  I can see the commands on the Object Browser
on the Vista machine, I just don't know how to insert a "Media Player"
instead of a "Windows Media Player".  Putting the "Media Player" on a
worksheet works on the XP machine until the file is closed.  Upon opening, it
crashes Excel and won't run again.

Private Sub TryIt()
    'Runs msdxm.ocx ActiveX object on UserForm1.  It actually seemsto work.
    Dim MediaFileName As String
    MediaFileName = Range("B2")

    Application.EnableEvents = True

    Load UserForm1
    UserForm1.MediaPlayer1.AutoStart = False
    UserForm1.MediaPlayer1.Filename = MediaFileName
    UserForm1.MediaPlayer1.ShowTracker = True
    UserForm1.MediaPlayer1.ShowStatusBar = True
    UserForm1.MediaPlayer1.SelectionStart = Range("B3")
    UserForm1.MediaPlayer1.SelectionEnd = Range("B4")
    UserForm1.MediaPlayer1.Play
    UserForm1.Show
    Unload UserForm1
End Sub

Using the ActiveX object which references wmp.dll on a UserForm works on
both the XP and Vista machine.  I can set the starting point, but have no
clue how to stop it at the desired point.  Is there a way to monitor the
current location of the media playing and stop it?  Is there some tricky way
the set SelectionEnd with this object?  I am guessing that I will need to
have my own controls to get this to behave.

Sub TryIt()
    'Runs wmp.dll ActiveX object on UserForm1.  The start sort of works, but
no end.
    Dim MyStart As Long
    Dim MyEnd As Long
    Dim MyStringStart As String
    Dim MyFile As String

    MyFile = Range("B2")
    MyStart = Range("B3")
    MyEnd = Range("B4")

    Application.EnableEvents = True
    Load UserForm1
    UserForm1.Caption = "Time 1 - Time 2"
    UserForm1.WindowsMediaPlayer1.settings.autoStart = False

    UserForm1.WindowsMediaPlayer1.URL = MyFile
    UserForm1.WindowsMediaPlayer1.Controls.currentPosition = MyStart        
    UserForm1.WindowsMediaPlayer1.Controls.Play
    UserForm1.Show
    Unload UserForm1
End Sub

I am open to other options.  Any help is more than appreciated.  Thanks
Zipcurs

Take a look at this thread - Harmeet Singh posted VBA-MP3-Player.xls
which runs windows media player from within Excel. Unfortunately he
has not yet provided the password to the underlying code.
 
J

Jef Gorbach

Looked a little deeper.

A google search on the filename found several hits implying the actual
author was Asri Jakarta with one listing providing his gmail address.

"VBA MP3 Player Posted by asri001 on 10 Dec 2009 at 7:41 PM
This is a sample of exploring macro Ms. Excel (Visual Basic of
Application - VBA) to create a MP3 Player that running on Ms. Excel
application.
Please check or take a look the program by download it from
http://wl.filegenie.com/~Rusdi/VBA-MP3-Player.xls
Set security level of macro Ms. Excel to Medium before running the
program.


Asri
Jakarta - Indonesia
(e-mail address removed)"

also found a facebook for him: http://www.facebook.com/profile.php?id=1238265927
along with blog http://asri-rusdi.blogspot.com/2009/08/explore-ms-officeexcel_14.html

good luck.
 
Z

ZipCurs

Hello Joel,

Thanks for the suggestion. I have been trying to use the Object Browser,
but I am not quite clear what it means. My current interpretation is ... if
you can figure out how to get to it, these object and commands are currently
available to you.

Having said that, I have no idea how to make use of msdxmlc.dll. As far as
I can tell this object is not available to me. Any help you can provide
would be appreciated.
 
Z

ZipCurs

Hello Joel,

I have just gotten back to this. Thanks for your suggestion, but my limited
skills did not lead to a solution following this path. I am moving closer to
a workable solution using the wmp.dll on a UserForm, but still have some
issues that I may be asking about in a separate post.

Thanks for your help.

ZipCurs
 

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