VBA Excel Loop A Sound?

January 21, 2011 at 10:25:01
Specs: Windows XP
I am currently using the following code to play a Wav file, but i want to make it loop.


Option Explicit
Private Declare Function sndPlaySound32 Lib "WINMM.DLL" _
Alias "sndPlaySoundA" (ByVal lpszSoundName _
As String, ByVal uFlags As Long) As Long


Sub PlaySong(ByVal Play As Boolean)
If Play = True Then
Call sndPlaySound32("C:\Documents and Settings\Owner\Desktop\spelunk.wav", 1)
Else
Call sndPlaySound32("C:\Documents and Settings\Owner\Desktop\spelunk.wav", 0)
End If
End Sub


See More: VBA Excel Loop A Sound?

Report •

#1
January 22, 2011 at 18:16:52
Have you considered adding a PlayAgain: label and a GoTo PlayAgain instruction?

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •
Related Solutions


Ask Question