Add Sound to command button event

M

mbox204

Hello,

Need to have a sound bite play on click of a command button, a *.wav file or
similar. Anyone have any experience or guidence to a link for that
capability, having trouble getting into the MS Knowledge base areas tonight
for some reason.

Thanks for your assistance.
 
P

PC Datasheet

From my file ---

See below my SIG line.


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

Play A Sound In Any Event



To play a sound in any event, just set an event such as a form's OnOpen to:

=PlaySound("C:\WINDOWS\CHIMES.WAV")

Paste the following declaration and function into a module and save:


Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _
(ByVal filename As String, ByVal snd_async As Long) As Long


Function PlaySound(sWavFile As String)
' Purpose: Plays a sound.
' Argument: the full path and file name.

If apisndPlaySound(sWavFile, 1) = 0 Then
MsgBox "The Sound Did Not Play!"
End If
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top