Replace "C:\ding.wav" with the file path and file name of your sound file.
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Const SND_ASYNC = &H1 'play asynchronously
Const SND_FILENAME = &H20000 'name is a file name
Private Sub play(soundName As String)
PlaySound SoundName, 0, SND_ASYNC Or SND_FILENAME
End Sub
If myvariable > 10 Then
play("C:\ding.wav"
msgbox ("myvariable cannot be greather than 10"
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.