Play sound

  • Thread starter Thread starter aac
  • Start date Start date
Something like this should do it... Add a command button from the Control
toolbox and pste this code in the sheet (right click the sheet tab and select
view code)...

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

Public Function PlayWavFile(WavFile As String) As String
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME
PlayWavFile = ""
End Function

Private Sub CommandButton1_Click()
PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav"
End Sub
 
Thanks Jim,
It works great
--
aac


Jim Thomlinson said:
Something like this should do it... Add a command button from the Control
toolbox and pste this code in the sheet (right click the sheet tab and select
view code)...

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

Public Function PlayWavFile(WavFile As String) As String
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME
PlayWavFile = ""
End Function

Private Sub CommandButton1_Click()
PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.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