Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ThisWorkbook.Path & "\" & .... not WAVFile, but AVI file...
Hi there... I got this code from somewhere (apologies for not knowing who)
I would like to alter it so if the .avi file was in the same directory the .xls file...it would play the avi.... I have a xl file that plays a .wav file and the syntax looks like this: WAVFile = "dogbark.wav" WAVFile = ThisWorkbook.Path & "\" & WAVFile but I cannot get it to work in the code below. So as long as the required .wav file is in the same folder as the xl book it finds and plays the file can this also be done to the code below? many thanks seeya ste Option Explicit Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal _ lpstrCommand As String, ByVal lpstrReturnStr As Any, ByVal wReturnLen _ As Long, ByVal hCallBack As Long) As Long Declare Function GetActiveWindow Lib "USER32" () As Integer Const WS_CHILD = &H40000000 Sub PlayAVIFile() Dim CmdStr As String, FileSpec As String Dim Ret As Integer, XLSHwnd As Integer FileSpec = "C:\windows\clock.avi" XLSHwnd = GetActiveWindow() CmdStr = ("open " & FileSpec & _ " type AVIVideo alias animation parent " & _ LTrim$(Str$(XLSHwnd)) & " style " & LTrim$(Str$(WS_CHILD))) Ret = mciSendString(CmdStr, 0&, 0, 0) Ret = mciSendString("put animation window at 80 170 370 370", _ 0&, 0, 0) Ret = mciSendString("play animation wait", 0&, 0, 0) Ret = mciSendString("close animation", 0&, 0, 0) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can Macro update "ThisWorkbook" sheet? | Excel Discussion (Misc queries) | |||
Programatically adding macro to Excel - "ThisWorkbook" | Excel Discussion (Misc queries) | |||
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F | Excel Discussion (Misc queries) | |||
Make "BeforeSave" event supply a default path and file name? | Excel Programming | |||
"Path/File Access Error" on Sheets.Copy | Excel Programming |