Public Declare Function sndPlaySoundA Lib "winmm.dll" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Sub PlayWav(WavFile As String)
If Application.CanPlaySounds = False Then
MsgBox "Sorry, sound is not supported on your system."
Exit Sub
End If
If Dir(WavFile) = "" Then
MsgBox ("Wave file not found")
Exit Sub
End If
sndPlaySoundA WavFile, 1
End Sub
Public Sub TestPlayWav1()
Dim filePath As String
filePath = ActiveWorkbook.Path
PlayWav (filePath & "\Sounds\cannon.wav")
End Sub