Tuesday, November 22, 2005
  
Declare Function WinAPI_PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

Function PlaySound(pstrSound As String)
On Error GoTo PlaySoundObject_Err
Dim strDir As String
Dim i As Integer
Dim hModule As Long

i = WinAPI_PlaySound(ByVal pstrSound, hModule, 1)

PlaySoundObject_Exit:
On Error Resume Next
Exit Function

PlaySoundObject_Err:
Select Case Err
Case Else
MsgBox Err.Description, 16, "Error " & Err & " in PlaySoundObject()"
End Select
Resume PlaySoundObject_Exit
Resume

End Function