VBA script to send a filename (drive/path) and launch to play WMP

H

hayashi

Hi everyone,

Sorry if I post this in the wrong forum - please direct me if it's.

I would like to know how to write a VBA script to send a filename (e.g.
"c:\My Documents\My Video\MyTest.MPG") to launch Window Media Player
(wmp.ocx) as output.

I can see lots of these OCX files from the VBA Editor's Tools | References
- Window Media Encoder
- Window Media Encoder Agent
- Window Media Encoder Agent Locator
- Window Media Encoder Device Control
- Window Media Encoder Preview Control
- Window Media Player C:\WINDOWS\system32\wmp.ocx
- Window Media Player C:\WINDOWS\system32\msdxm.ocx
- Window Media Player Compatibility layer
- Window Media Player Launcher

But I don't know where to get these syntax and its parenthesis/parentheses

Appreciate if anyone can direct me with examples/samples would be a good
start.

Thanks in advance!

Regards.
 
P

Paolo

Hi hayashi,
you can use the shell function:
x = Shell("C:\Program Files\Windows Media Player\wmplayer.exe " & """c:\My
Documents\My Video\MyTest.MPG""", vbNormalFocus)

Adjust the path of wmplayer.

HTH Paolo
 
H

hayashi

Many Thanks for your time and reply HTH Paolo!

That's really saving lots of coding, like declaration & syntax expression.

Best Regards, hayashi
 
Top