Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is BEEP all there is??
Is there any functionality in VBA to produce tones of varying pitch ,
intensity, and duration similar to the SOUND command in earlier versions of BASIC? -- Gary's Student |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is BEEP all there is??
Here is an API to play whatever wav file makes you happy.
Option Explicit Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _ (ByVal lpszName As String, hModule As Long, ByVal dwFlags As Long) As Long Private Sub Test() PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav" End Sub Public Function PlayWavFile(WavFile As String) As String Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME PlayWavFile = "" End Function HTH "Gary's Student" wrote: Is there any functionality in VBA to produce tones of varying pitch , intensity, and duration similar to the SOUND command in earlier versions of BASIC? -- Gary's Student |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is BEEP all there is??
Thanks, I guess the burden has shifted from programming Basic to make sounds
to programming some other software to make .wav files? -- Gary's Student "Jim Thomlinson" wrote: Here is an API to play whatever wav file makes you happy. Option Explicit Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _ (ByVal lpszName As String, hModule As Long, ByVal dwFlags As Long) As Long Private Sub Test() PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav" End Sub Public Function PlayWavFile(WavFile As String) As String Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME PlayWavFile = "" End Function HTH "Gary's Student" wrote: Is there any functionality in VBA to produce tones of varying pitch , intensity, and duration similar to the SOUND command in earlier versions of BASIC? -- Gary's Student |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is BEEP all there is??
In xl9x I believe Beep is all there is. In NT/XP/2003, you can control the
internal speaker (which makes the beep) Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long Sub Beep1() Dim num As Single Dim num1 As Long Dim numLoops As Single num = 10 NumSeconds = 4 '<== duration numLoops = (NumSeconds * num * 2) / 2 If numLoops < 1 Then numLoops = 1 End If num1 = 1000 / (num * 2) For i = 1 To numLoops 'DoEvents Beep 500, num1 'DoEvents Beep 10000, num1 'DoEvents Next End Sub The first argument is the frequency. You can change the 10000 (you can't hear that) to 1000 to get a different affect for example. -- Regards, Tom Ogilvy "Gary's Student" wrote in message ... Thanks, I guess the burden has shifted from programming Basic to make sounds to programming some other software to make .wav files? -- Gary's Student "Jim Thomlinson" wrote: Here is an API to play whatever wav file makes you happy. Option Explicit Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _ (ByVal lpszName As String, hModule As Long, ByVal dwFlags As Long) As Long Private Sub Test() PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav" End Sub Public Function PlayWavFile(WavFile As String) As String Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME PlayWavFile = "" End Function HTH "Gary's Student" wrote: Is there any functionality in VBA to produce tones of varying pitch , intensity, and duration similar to the SOUND command in earlier versions of BASIC? -- Gary's Student |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is BEEP all there is??
Thank you both very much.
-- Gary's Student "Tom Ogilvy" wrote: In xl9x I believe Beep is all there is. In NT/XP/2003, you can control the internal speaker (which makes the beep) Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long Sub Beep1() Dim num As Single Dim num1 As Long Dim numLoops As Single num = 10 NumSeconds = 4 '<== duration numLoops = (NumSeconds * num * 2) / 2 If numLoops < 1 Then numLoops = 1 End If num1 = 1000 / (num * 2) For i = 1 To numLoops 'DoEvents Beep 500, num1 'DoEvents Beep 10000, num1 'DoEvents Next End Sub The first argument is the frequency. You can change the 10000 (you can't hear that) to 1000 to get a different affect for example. -- Regards, Tom Ogilvy "Gary's Student" wrote in message ... Thanks, I guess the burden has shifted from programming Basic to make sounds to programming some other software to make .wav files? -- Gary's Student "Jim Thomlinson" wrote: Here is an API to play whatever wav file makes you happy. Option Explicit Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _ (ByVal lpszName As String, hModule As Long, ByVal dwFlags As Long) As Long Private Sub Test() PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav" End Sub Public Function PlayWavFile(WavFile As String) As String Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME PlayWavFile = "" End Function HTH "Gary's Student" wrote: Is there any functionality in VBA to produce tones of varying pitch , intensity, and duration similar to the SOUND command in earlier versions of BASIC? -- Gary's Student |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is BEEP all there is??
Thanks Tom... One more API for me ply with...
"Tom Ogilvy" wrote: In xl9x I believe Beep is all there is. In NT/XP/2003, you can control the internal speaker (which makes the beep) Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long Sub Beep1() Dim num As Single Dim num1 As Long Dim numLoops As Single num = 10 NumSeconds = 4 '<== duration numLoops = (NumSeconds * num * 2) / 2 If numLoops < 1 Then numLoops = 1 End If num1 = 1000 / (num * 2) For i = 1 To numLoops 'DoEvents Beep 500, num1 'DoEvents Beep 10000, num1 'DoEvents Next End Sub The first argument is the frequency. You can change the 10000 (you can't hear that) to 1000 to get a different affect for example. -- Regards, Tom Ogilvy "Gary's Student" wrote in message ... Thanks, I guess the burden has shifted from programming Basic to make sounds to programming some other software to make .wav files? -- Gary's Student "Jim Thomlinson" wrote: Here is an API to play whatever wav file makes you happy. Option Explicit Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _ (ByVal lpszName As String, hModule As Long, ByVal dwFlags As Long) As Long Private Sub Test() PlayWavFile "C:\Windows\Media\Microsoft Office 2000\Chimes.wav" End Sub Public Function PlayWavFile(WavFile As String) As String Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 PlaySound WavFile, 0, SND_ASYNC Or SND_FILENAME PlayWavFile = "" End Function HTH "Gary's Student" wrote: Is there any functionality in VBA to produce tones of varying pitch , intensity, and duration similar to the SOUND command in earlier versions of BASIC? -- Gary's Student |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Beep on greater than zero | New Users to Excel | |||
BEEP | Excel Discussion (Misc queries) | |||
turn off beep | Excel Discussion (Misc queries) | |||
I want to *beep* *beep*!!!! | Excel Programming | |||
I want to *beep* *beep*!!!! | Excel Programming |