Conditionally playing a wave file
This is the code I'm trying to use but I'm getting nothing. I'd prefer to set the path to
C:\Users\X\Music\WWE\
Basically whenever M2>0 I'd like the wav file to play.
(This is set in Sheet Tab- View Code Declarations)
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
(This part was in a combined PlayWav)
Sub PlayWAV()
WavFile = ThisWorkbook.Path & "\BoDallasA.wav"
Call PlaySound(WavFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Threshold = 0
If Range("M2").Value > Threshold Then PlayWAV
End Sub
|