I want to play one of two wav files when cell D11 value changed from Right to Wrong. What I have works perfectly for the value "Right". But I don't know how to change the code to play a wav for "Wrong". I tried adding a second modual but that did not work.
Sheet 1
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("D11").Value = "Right" Then
PlayWav
End If
End Sub
Modual 1
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Sub PlayWav()
Dim WAVFile As String
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
On Error GoTo ErrHandler
WAVFile = "C:UsersBillDesktopWhoopFlp.wav"
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
Exit Sub
ErrHandler:
End Sub
Software/Hardware used:
ASKED:
June 20, 2012 5:03 AM
UPDATED:
June 21, 2012 9:04 AM