بهتره اسم مدل داس فایل رو بگیرید و اونو به mciExecute بفرستید.
Option Explicit
Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As
String) As Long
Private Declare Function GetShortPathName Lib "kernel32" Alias
"GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As
String, ByVal cchBuffer As Long) As Long
Private Const MAX_PATH As Long = 260
Private Function GetShortFileName(ByVal LongFileName As String) As String
Dim sBuffer As String
sBuffer = String$(MAX_PATH, vbNullChar)
Call GetShortPathName(LongFileName, sBuffer, MAX_PATH)
GetShortFileName = Left$(sBuffer, InStr(1, sBuffer, vbNullChar) - 1)
End Function
Private Sub Form_Click()
Dim sFileName As String
Dim lRet As Long
If Right$(App.Path, 1) <> "\" Then
sFileName = App.Path & "\sound.wav"
Else
sFileName = App.Path & "sound.wav"
End If
sFileName = GetShortFileName(sFileName)
lRet = mciExecute("play " & sFileName)
If lRet = 0 Then
MsgBox "Error playing sound"
End If
End Sub