Does anyone know where I can find VBA code examples that start, pause, stop, or
even minimize and otherwise monitor the status of an active Windows Media Player.
For example, from a VBA module in Excel ('97 according to the Pros), you can
start the player with the following code:
cmd = "Start " & Chr(34) & ActiveCell.Text & Chr(34)
Shell cmd
But suppose I have a bunch of cells in a column and I want the player to play one
cell at a time from the first cell on down.
How can I wait until the player if finished playing the first sound
file before going down to the next cell (here the text in the active cell is the
file path and file name of the sound file)? What's the command in VBA that
will "monitor" the status of the player: for example, what's the VBA code
equivalent of: If the player is still playing, don't go down to the next cell,
but do go down as soon as it has stopped playing (I guess you could also find out
the length of time the sound file being played is for and use that info with the
Application.Wait Now + TimeValue("info") before looping back to cmd. I just don't
know how to do that.
Regards.
Marc R. Bertrand
If you really need to get that sort of control over the Media
Player, you should be creating and controlling it entirely via
automation. There are a variety of controls and libraries
installed with Media Player that facilitate this. When you start
the player with the Start command, you really have no way to
control it.
You should be handling the creation and control of Media Player
entirely via automation.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com ch...@cpearson.com
"Marc R. Bertrand" <m_r_be...@my-deja.com> wrote in message
news:58ad01c0ec98$17a46dd0$19ef2ecf@tkmsftngxa01...
http://msdn.microsoft.com/library/psdk/wm_media/wmplay/mmp_sdk/aboutthewindo
wsmediaplayercontrol.htm\
Introducing the Version 6.4 Windows Media Player Control
NOTE:
Note that Windows Media Player 7 does not support embedding the control in
any applications that use Microsoft Visual Basic or Visual C++ through
IDispatch. Only embedding in a Web page is supported. Also, version 7 does
not support a Netscape Navigator plug-in. For these reasons, the 6.4 version
of the control is also installed when the end-user installs Windows Media
Player. The new control and the old control have different ClassID numbers,
different object models, and different sets of functionalities.
[so you need to use version 6.4 of the control as I read this]
http://msdn.microsoft.com/library/psdk/wm_media/wmplay/mmp_sdk/microsoftwind
owsmediaplayercontrolversion64sdk.htm
The Windows Media Player control version 6.4 (Msdxm.ocx) is a Microsoft®
ActiveX® control used for adding multimedia playback capabilities to
COM-based documents and applications, as well as Web pages.
http://msdn.microsoft.com/library/psdk/wm_media/wmplay/mmp_sdk/controllingth
ewindowsmediaplayerfromscripts.htm
Controlling the Windows Media Player from Scripts
This topic applies to Windows Media Player version 6.4 only.
Performing Basic Playback Operations
http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/wm_media/wmp
lay/mmp_sdk/architecture.htm
This section introduces the basics of the Version 6.4 Windows Media Player
control, which enables you to easily enrich static content with dynamic,
interactive functionality. see:
Placing the Windows Media Player Control in a Visual Basic Application
Regards,
Tom Ogilvy
"Marc R. Bertrand" <m_r_be...@my-deja.com> wrote in message
news:58ad01c0ec98$17a46dd0$19ef2ecf@tkmsftngxa01...