Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello:
Can somebody explain to me how to add a sound file to a macro. I need exact instructions, since what I got (below) does not seem to work for some reason, and error comes up. Can you please explain how to do it exactly? Here is what I have: Public Declare Function sndPlaySound Lib "winmm.dll" _ Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _ ByVal uFlags As Long) As Long Sub PlayWavFile(WavFileName As String, Wait As Boolean) If Dir(WavFileName) = "" Then Exit Sub ' no file to play If Wait Then ' play sound before running any more code sndPlaySound WavFileName, 0 Else ' play sound while code is running sndPlaySound WavFileName, 1 End If End Sub Sub TestPlayWavFile() PlayWavFile "c:\foldername\soundfilename.wav", False MsgBox "This is visible while the sound is playing..." PlayWavFile "c:\foldername\soundfilename.wav", True MsgBox "This is visible after the sound is finished playing..." End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding a new row with a macro | Excel Discussion (Misc queries) | |||
Adding to a Macro | Excel Discussion (Misc queries) | |||
Adding a Tab in a Macro | Excel Discussion (Misc queries) | |||
adding macro | Excel Programming | |||
Adding Row to this macro | Excel Discussion (Misc queries) |