我有一个使用哔声的代码,我想把它做成 MP3、WMA 之类的音频文件,有人可以帮我吗?
这是我的代码
模块 :
Public Declare Function Beep Lib "kernel32" _
(ByVal dwFreq As Long, _
ByVal dwDuration As Long) As Long
主要代码:
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim LR As Long
Set ws = ActiveSheet
LR = ws.Range("A" & Rows.Count).End(xlUp).Row
tempo = 500 '0.5 sec
For I = 1 To LR
HB = ws.Range("B" & I).Value
L = ws.Range("C" & I).Value
Beep HB, L
Next I
End Sub
如果你*.wav
从 VBA播放一些特定的声音,这样的东西应该很不错:
Option Explicit
Public Declare Function sndPlaySound32 Lib "winmm.dll" _
Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Sub VBASound()
Application.EnableSound = True
sndPlaySound32 ActiveWorkbook.Path & "\LoadIt.WAV", 0
End Sub
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句