Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute WMP from Excel 1

Status
Not open for further replies.

terzaghi

Programmer
Aug 25, 2003
49
0
0
IT
Hello,

is it possible to control Windows Media Player from Excel such as I can execute videos or sounds (voice recording) when a certain condition is obtained? Obviously I check the condition with a macro...

I need to open WMP, execute a certain media file and then close it when finished.
I'm not fixed on WMP, any other player is good....

any ideas?
Thanks a lot!!
 
should be able to call a BAT file from VBA using the SHELL method. The BAT file should be able to pick up WMP or any other app...

Rgds, Geoff

Three things are certain. Death, taxes and lost data. DPlank is to blame

Please read FAQ222-2244 before you ask a question
 
If you can find 'msdxm.ocx' and make a reference to it (Windows Media Player), you could add WindowsMedia control to the toolbox and use it on a sheet or userform. There are some methods/properties/events available to control media, however I have not found anything to record sound. Sample code, UserForm:

With Me.MediaPlayer1
.Volume = -600
.DisplaySize = mpFullScreen
.Open "c:path\FileName.avi"
End With

combo
 
Thanks a lot!

It works very fine. I have only a Problem... How can I detect the end of the movie so I can close the form by utself without a click?

I didn't find any method in MediaPlayer activeX. maybe it's because I'm tired...
 
Combo,

I think you made your form and code with Win2000, correct?

with win2000 it works fine as I already said, but I tried also with WinXp and the result is that "Me.MediaPlayer1" is not understood by the compiler, insted you have to write
"Me.WindowsMediaPlayer1" and the method .Open does not exist anymore.

the point is that the code written with Win2000 is not compatible with WinXp.....

 
Depending on media player version, there are different activeX controls. MediaPlayer control is an old 6.4 version. WindowsMediaPlayer is a newer one, guess that 9, and comes with wmp.dll. Both have reference name 'Windows Media Player'.
Both controls are external to office and connected with Media Player. You can get WindowsMediaPlayer in win 2k (and 98) after upgrading Media Player and change reference library in VBE.
To get available events, see, in Object Browser, in WMPLib (upgraded player version, MediaPlayer for older one), WindowsMediaPlayer class members. In available events, among others, the EndOfStream may be interesting for you.
Hope that now it will work.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top