LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default Adding sount to a macro

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
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
Adding a new row with a macro Dobbs734 Excel Discussion (Misc queries) 2 June 1st 09 06:08 PM
Adding to a Macro Steven Excel Discussion (Misc queries) 2 December 15th 08 06:21 PM
Adding a Tab in a Macro [email protected] Excel Discussion (Misc queries) 10 February 28th 06 09:57 PM
adding macro Lynn[_6_] Excel Programming 6 October 3rd 05 08:39 AM
Adding Row to this macro Nigel Excel Discussion (Misc queries) 2 May 4th 05 05:27 PM


All times are GMT +1. The time now is 09:02 AM.

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

About Us

"It's about Microsoft Excel"