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.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("D11").Value = "Right" Then
Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
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)
June 20, 2012 5:03 AM
June 21, 2012 9:04 AM