如果用VBA代码播放WAV声音文件,可以用下面的代码:
Private Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Sub PlayWavFile()
sndPlaySound32 "C:/Windows/Media/ding.wav", 0&
End Sub
运行上述代码将播放C:/Windows/Media”文件夹中的ding.wav声音文件。
转载请注明:范的资源库 » excel利用VBA播放WAV声音文件