PDA

View Full Version : Problems with media player



lifeson
12-17-2008, 07:04 AM
I have a form which lists a set of media files which can be various type including mpg files
I want to be able to click on the file name and play the file
I thought windows media player would be the best option to show all the different file types

I have had a dig around a come up with these two options but I get an error with both

The shell method says the file is not recognized but the file is definietly in the path specified

with wmp object give this error:
method "FullScreen" of object 'IWMPPLayer4' failed

Dim wmp As WindowsMediaPlayer
Dim file As String
Set wmp = CreateObject("WMplayer.ocx")
file = Item.Key
'confirms correct file is to be displayed
MsgBox file
'Shell ("C:\Program Files\Windows Media Player\wmplayer.exe" & file & "")
With wmp
.FullScreen = True
.URL = file
.Controls.Play
End With

The object must be there as I get all the methods listed when I use with wmp.

Any ideas :think:

Kenneth Hobs
12-17-2008, 08:14 AM
You should use early binding instead of late binding.

A better approach would be to use the Windows Media Player object. See http://www.vbaexpress.com/forum/showthread.php?t=10612