在ExcelVba中使用API函数playSound播放声音 PlaySound函数的声明如下: Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long 参数lpszName表示声音名,可以是文件名,系统事件名或内存地址,参数hModule只用于播放...
Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long 参数lpszName表示声音名,可以是文件名,系统事件名或内存地址,参数hModule只用于播放嵌入资源,其它的时候设置为0&,参数dwFlags是各种标志常量的组合,有下面...
2.点击插页>模块,然后将以下代码粘贴到模块窗口。 VBA代码:根据单元格值播放特定的声音: #If Win64 ThenPrivateDeclarePtrSafeFunctionPlaySoundLib"winmm.dll"_Alias"PlaySoundA"(ByVallpszNameAsString,_ByValhModuleAsLongPtr,ByValdwFlagsAsLong)AsBoolean#ElsePrivateDeclareFunctionPlaySoundLib"winmm.dll"_Alias"...
VBA代码:根据单元格值播放特定的声音: #If Win64 Then Private Declare PtrSafe Function PlaySound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal lpszName As String, _ ByVal hModule As LongPtr, ByVal dwFlags As Long) As Boolean #Else Private Declare Function PlaySound Lib "winmm.dll" _ Alia...
如果您想播放默认系统提示音以外的其他声音,这里的VBA代码也可以帮您一个忙。 1。 按住ALT + F11键,然后打开Microsoft Visual Basic应用程序窗口。 2.点击插页>模块,然后将以下代码粘贴到模块窗口。 VBA代码:根据单元格值播放特定的声音: #If Win64 Then Private Declare PtrSafe Function PlaySound Lib "winmm.dl...
1.打开工作簿,按快捷键Alt+F11,打开VBA编辑器。 2.单击菜单“插入→模块”,Excel将插入一个名称为“模块1”的模块。 3.在右侧代码窗口中粘贴下列代码: Private Declare Function sndPlaySound32 _ Lib "winmm.dll" _ Alias "sndPlaySoundA" ( _
1.打开工作簿,按快捷键Alt+F11,打开VBA编辑器。 2.单击菜单“插入→模块”,Excel将插入一个名称为“模块1”的模块。 3.在右侧代码窗口中粘贴下列代码: Private Declare Function sndPlaySound32 _ Lib "winmm.dll" _ Alias "sndPlaySoundA" ( _
1.打开工作簿,按快捷键Alt+F11,打开VBA编辑器。2.单击菜单“插入→模块”,Excel将插入一个名称为“模块1”的模块。3.在右侧代码窗口中粘贴下列代码:Private Declare Function sndPlaySound32 _Lib "winmm.dll" _Alias "sndPlaySoundA" ( _ByVal lpszSoundName As String, _ByVal uFlags As ...
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long 再在Workbook的BeforeSave事件中(根据需要也可以选用其他事件)加入下列用VBA编写的宏代码: With Sheet1 If .Range("A2").Value 〉 2 Or .Range("A2").Value 〈 -...
在Excel报表中使用语音提示 Option Explicit Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long 再在Workbook的BeforeSave事件中(根据需要也可以选用其他事件)加入下列用VBA编写的宏代码: With Sheet1 If ....