Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' name is a file name
Private Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Private Sub Form_Click()
Dim ret As Boolean
ret = sndPlaySound("c:\windows\media\tada.wav", (SND_ASYNC Or SND_FILENAME Or SND_NODEFAULT))
If ret = False Then
MsgBox "Error"
End If
End Sub