Call windows API to play a sound : Wav Sound « Windows API « VBA / Excel / Access / Word






Call windows API to play a sound

 
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Public Sub PlaySound(SoundFile As String)
    sndPlaySound SoundFile, 1
End Sub

 








Related examples in the same category

1.Adding Sound to a VBA Program