View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jef Gorbach[_2_] Jef Gorbach[_2_] is offline
external usenet poster
 
Posts: 65
Default Media Player Help

On Feb 12, 11:43*am, ZipCurs
wrote:
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.currentPosi tion = 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.