5 pts.
 I want to play one of two wav files
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

Answer Wiki:
Try adding a PlayWav2() subroutine targeted to your desired .wav file and add a second if/then statement pointing to PlayWav2(). I would copy from Sub PlayWav() to End Sub, changing the WAVFile value and placing the new code beneath instead of adding a whole new module.
Last Wiki Answer Submitted:  June 21, 2012  9:04 am  by  ShawnHendricks   1,590 pts.
All Answer Wiki Contributors:  ShawnHendricks   1,590 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _