首页 > Excel专区 > Excel教程 >

excel利用VBA播放WAV声音文件

Excel教程 2021-11-13 11:38:13

如果用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声音文件如果

office教程网 Copyright © 2016-2020 https://www.office9.cn. Some Rights Reserved.