play sound

  • Thread starter Thread starter Dan D
  • Start date Start date
D

Dan D

Hello,

I have a spreadsheet that has some checkboxes. I want a
sound to play when the checkbox is clicked. How can I do
this?

Thanks
 
Hi

Paste this in a module:

Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long

Sub PlayMe(OurSong As String)
Dim retval As Long
retval = PlaySound(OurSong, _
0, &H20000)
End Sub

And call it from the proper event, like

Private Sub CheckBox1_Click()
Call PlayMe("C:\Windows\media\1812Ouverture.wav")
End Sub
 

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

Back
Top