Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to call up WAV files in Excel XP? I seem to recall this was
easy in earlier versions but I can't find anything in VB help files. Thanks. David |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Feb 3, 9:15 pm, "David Overington" wrote:
Is it possible to call up WAV files in Excel XP? I seem to recall this was easy in earlier versions but I can't find anything in VB help files. Thanks. David Hello David, You need to call an API to play a sound file. Here is the code. Change the file path to the sound file you want to play in the macro "PlaySoundFile". Load this into a Standard VBA module. Start Macro ================================================== ======================================= Private Declare Function PlaySound _ Lib "winmm.dll" _ Alias "PlaySoundA" _ (ByVal lpszName As String, _ ByVal hModule As Long, _ ByVal dwFlags As Long) As Long Sub PlaySoundFile() Dim Ret As Long Const SND_SYNC As Long = &H0 'play synchronously (default) Ret = PlaySound("C:\MyWavFile.wav", 0&, SND_SYNC) End Sub ================================================== ==================================== End Macro Sincerely, Leith Ross |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perfect!
Many thanks, Leith, for the code and the clear layout. Regards, David "Leith Ross" wrote in message ... On Feb 3, 9:15 pm, "David Overington" wrote: Is it possible to call up WAV files in Excel XP? I seem to recall this was easy in earlier versions but I can't find anything in VB help files. Thanks. David Hello David, You need to call an API to play a sound file. Here is the code. Change the file path to the sound file you want to play in the macro "PlaySoundFile". Load this into a Standard VBA module. Start Macro ================================================== ======================================= Private Declare Function PlaySound _ Lib "winmm.dll" _ Alias "PlaySoundA" _ (ByVal lpszName As String, _ ByVal hModule As Long, _ ByVal dwFlags As Long) As Long Sub PlaySoundFile() Dim Ret As Long Const SND_SYNC As Long = &H0 'play synchronously (default) Ret = PlaySound("C:\MyWavFile.wav", 0&, SND_SYNC) End Sub ================================================== ==================================== End Macro Sincerely, Leith Ross |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 tmp files filling up drive with XLSM files | Excel Worksheet Functions | |||
How to change default Open/Files of Type to "Microsoft Excel Files | Excel Discussion (Misc queries) | |||
how to default WritePassword under excel workbook property for any files as long as those files are the offsprings of the parent file | Excel Programming | |||
Drive Erased, got Files back but only excel files scrambled, help. | Excel Discussion (Misc queries) | |||
Macro to open *.dat files and save as .txt (comma delimited text files) | Excel Programming |