Sounds in Excel

  • Thread starter Thread starter J. Vandenberg
  • Start date Start date
J

J. Vandenberg

Is there any way to get excel to play wav sounds on events?
I noticed that the standard VB functions for sounds are not available
in the VBA help section, was just wondering if you could call a
windows api to do it or something.
Thanks,
-Joel
 
By the way, I did a search for this but didn't find the articles
attached.
Must have done something wrong, thanks again for answering an old
quesiton.

One follow up I have (as long as I am typing) I noticed that when it
is executing the sound, that the code waits for it to finish, I was
hoping that since it was a call to an api that it would make the call
and move on. Is there a way to have it sort of "let go" of it and
continue on and let the api play the sound without having to finish it
to get to the next line?

Hmmm... Does that make sense?

Your help is greatly appreciated.
-Joel
 
Joel,

You can play the sound "asynchronously", meaning that execution will
continue as soon as the sound begins to play rather than waiting for the
sound to finish, by changing the second argument of the function from 0 to
1.
 
You can play the sound asynchronously. See the first article for the
argument to supply the API:

http://support.microsoft.com/default.aspx?scid=kb;en-us;86281
HOWTO: Play a Waveform (.WAV) Sound File in Visual Basic
[Contains the Constants for the Arguments]

http://support.microsoft.com/default.aspx?scid=kb;en-us;158140
XL: How to Play Sounds Using Visual Basic for Applications

http://support.microsoft.com/default.aspx?scid=kb;en-us;149777
XL: How to Play a Warning Sound If Critical Value Is Exceeded


http://support.microsoft.com/default.aspx?scid=kb;en-us;170730
WD: How to Play a .wav Sound File by Using a Macro

http://support.microsoft.com/default.aspx?scid=kb;en-us;211842
WD2000: How to Play a .wav Sound File Using a Macro
 
Back
Top