Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Macro update "ThisWorkbook" sheet? Don Excel Discussion (Misc queries) 1 February 18th 09 07:58 PM
Programatically adding macro to Excel - "ThisWorkbook" Aerojade Excel Discussion (Misc queries) 3 October 1st 08 12:53 PM
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F daves Excel Discussion (Misc queries) 3 April 24th 07 04:52 AM
Make "BeforeSave" event supply a default path and file name? quartz Excel Programming 1 April 22nd 04 08:08 PM
"Path/File Access Error" on Sheets.Copy Nick Cranham Excel Programming 4 April 15th 04 01:41 PM


All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"