View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Michel Pierron Michel Pierron is offline
external usenet poster
 
Posts: 214
Default Running .avi files

Hi ste mac,
' In standard module:
Public Play As Boolean
Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, ByVal _
lpstrReturnString As String, ByVal uReturnLength _
As Long, ByVal hwndCallback As Long) As Long
Private Returnstring As String

Sub AVI_Play()
Const FileName As String = "c:\mybestfile.avi"
If Dir(FileName) = "" Then Exit Sub
If Play Then AVI_Stop
Returnstring = Space(127)
mciSendString "open " & Chr(34) & FileName & Chr(34) _
& " type avivideo alias video", Returnstring, 127, 0
mciSendString "set video time format ms", Returnstring, 127, 0
mciSendString "play video from 0", Returnstring, 127, 0
Play = True
End Sub

Sub AVI_Stop()
mciSendString "close video", Returnstring, 127, 0
Play = False
End Sub

'In ThisWorkbook module:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Play Then AVI_Stop
End Sub

Regards,
MP

"ste mac" a écrit dans le message de
om...
Hey guys....

I have been following your thread and the AVI macro is fantastic....

Do you have one that will run in a child window, whereas the spreadsheet
is visible while it runs.... thanks..

seya ste