Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet_Change - initiate macro on another worksheet oms Excel Programming 4 March 11th 08 03:26 PM
How do I initiate a macro directly in a worksheet? AMMPro Excel Programming 3 July 15th 06 11:02 PM
Initiate Macro On Save JTWood Excel Programming 2 June 14th 06 03:47 PM
Macro to initiate a spreadsheet to email Rich F[_2_] Excel Programming 2 November 12th 04 07:00 PM
DDE Initiate does not work Ferenc Nagy Excel Programming 0 October 11th 04 09:13 AM


All times are GMT +1. The time now is 07:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"