新建一个模块:
Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _
(ByVal filename As String, ByVal snd_async As Long) As Long
Function PlaySound(sWavFile As String)
If apisndPlaySound(sWavFile, 1) = 0 Then
MsgBox "The Sound Did Not Play!"
End If
End Function
调用方法:playsound("C:\Documents and Settings\Administrator\桌面\文件名.wav")
2003中通过测试,其他版本不详!
红色部分为wav文件路径名,可以自行修改。附件为一个wav文件用于测试,不需要可以不下载。
附 件:
点击下载此附件