![]() |
How to initiate a sound via VBA?
At a certain event (push button) I would like to have
a sound (.wav) file being played. Any advise? (for a test, I reconfigured the "Default Beep" in Windows to the desired wav-ile. And then programm a simple "Beep" in VBA. But that (of course) gives me a lot of strange sounds at many other windows-events...) Hary |
How to initiate a sound via VBA?
Hi,
You can find out how here http://www.j-walk.com/ss/excel/tips/tip59.htm Mike "Hartmut (Harry) Kloppert" wrote: At a certain event (push button) I would like to have a sound (.wav) file being played. Any advise? (for a test, I reconfigured the "Default Beep" in Windows to the desired wav-ile. And then programm a simple "Beep" in VBA. But that (of course) gives me a lot of strange sounds at many other windows-events...) Hary |
How to initiate a sound via VBA?
Here is one that will make a pinball machine sound if you enter a value
greater than 15 in cell C2. Just grab the inner portion of the If...Then block, put it in your sub for the button press and change to the wav file of your choice. '----------------------------------------- Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$C$2" Then Application.EnableEvents = False If Target.Value = 15 Then strWavPath = "C:\Program Files\Windows NT\Pinball\SOUND36.wav" x = Shell("sndrec32 /play /close " & Chr(34) & strWavPath & Chr(34), vbHide) End If Application.EnableEvents = True End If End Sub '---------------------------------------- Steve Yandl "Hartmut (Harry) Kloppert" wrote in message ... At a certain event (push button) I would like to have a sound (.wav) file being played. Any advise? (for a test, I reconfigured the "Default Beep" in Windows to the desired wav-ile. And then programm a simple "Beep" in VBA. But that (of course) gives me a lot of strange sounds at many other windows-events...) Hary |
How to initiate a sound via VBA?
Thanks, Steve. That was easy and effective!
Harry "Steve Yandl" wrote in message ... Here is one that will make a pinball machine sound if you enter a value greater than 15 in cell C2. Just grab the inner portion of the If...Then block, put it in your sub for the button press and change to the wav file of your choice. '----------------------------------------- Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$C$2" Then Application.EnableEvents = False If Target.Value = 15 Then strWavPath = "C:\Program Files\Windows NT\Pinball\SOUND36.wav" x = Shell("sndrec32 /play /close " & Chr(34) & strWavPath & Chr(34), vbHide) End If Application.EnableEvents = True End If End Sub '---------------------------------------- Steve Yandl "Hartmut (Harry) Kloppert" wrote in message ... At a certain event (push button) I would like to have a sound (.wav) file being played. Any advise? (for a test, I reconfigured the "Default Beep" in Windows to the desired wav-ile. And then programm a simple "Beep" in VBA. But that (of course) gives me a lot of strange sounds at many other windows-events...) Hary |
All times are GMT +1. The time now is 12:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com