graemeal
Active Member
- Joined
- May 17, 2007
- Messages
- 316
- Platform
- Windows
I have this code that triggers sound wavs when a condition has been met. The below has 2 triggers for 2 differant columns. I was wondering can I add a third one to it.
I have tried many variations but so far unsuccessful.
Thanks
XP SP3 XL 2007
I have tried many variations but so far unsuccessful.
Thanks
Code:
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
Private Sub Worksheet_Calculate()
Const FName1 As String = "C:\WINDOWS\Media\ding.wav"
Const FName2 As String = "C:\WINDOWS\Media\ringin.wav"
Dim h As Range
For Each h In Range("T2:T1896")
If h.Value > 1.5 Then
Call PlaySound(FName1, 0&, SND_SYNC Or SND_FILENAME)
Exit For
End If
Next h
For Each i In Range("Q2:Q1896")
If i.Value > 35 Then
Call PlaySound(FName2, 0&, SND_SYNC Or SND_FILENAME)
Exit For
End If
Next i
End Sub
XP SP3 XL 2007