Creating a "beep siren"?

blodzoom

Board Regular
Joined
Aug 5, 2005
Messages
103
I would like an alert sound that continues until the user interferes. I remember playing with BASIC as a kid and making annoying infinite sirens with a GOTO. I was hoping to be able to do that with a loop but it doesn't seem like you can change the sound of "beep"

Does anyone know how to do this?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I was playing about with your problem but I couldn't get it to work for the beep sound. So I used the Application.Speech() function. See if this will give you any ideas.

Open a new Excel workbook.
Press Alt+F11.
Click Insert => Module
Copy and paste the code.
Press F5 to run ESC to abort


Code:
[COLOR=darkblue]Sub[/COLOR] TestAlarm()   [COLOR=green]'==================[/COLOR]
   [COLOR=green]'press ESC to abort[/COLOR]
   [COLOR=green]'==================[/COLOR]
   [COLOR=darkblue]Dim[/COLOR] i [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
   [COLOR=darkblue]Dim[/COLOR] answer [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
   
   [COLOR=darkblue]On[/COLOR] [COLOR=darkblue]Error[/COLOR] [COLOR=darkblue]GoTo[/COLOR] errExit
   
   [COLOR=darkblue]For[/COLOR] i = 1 [COLOR=darkblue]To[/COLOR] 50
      Application.Speech.Speak ("Danger")
   [COLOR=darkblue]Next[/COLOR] i
   
   [COLOR=green]'abort or continue[/COLOR]
errExit:
   [COLOR=darkblue]If[/COLOR] MsgBox("Continue", vbYesNo) = vbNo [COLOR=darkblue]Then[/COLOR]
      [COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
   [COLOR=darkblue]Else[/COLOR]
      [COLOR=darkblue]Resume[/COLOR] [COLOR=darkblue]Next[/COLOR]
   [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
End [COLOR=darkblue]Sub[/COLOR]
 
Upvote 0
I was playing about with your problem but I couldn't get it to work for the beep sound. So I used the Application.Speech() function. See if this will give you any ideas.

Open a new Excel workbook.
Press Alt+F11.
Click Insert => Module
Copy and paste the code.
Press F5 to run ESC to abort


Code:
[COLOR=darkblue]Sub[/COLOR] TestAlarm()   [COLOR=green]'==================[/COLOR]
   [COLOR=green]'press ESC to abort[/COLOR]
   [COLOR=green]'==================[/COLOR]
   [COLOR=darkblue]Dim[/COLOR] i [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
   [COLOR=darkblue]Dim[/COLOR] answer [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
   
   [COLOR=darkblue]On[/COLOR] [COLOR=darkblue]Error[/COLOR] [COLOR=darkblue]GoTo[/COLOR] errExit
   
   [COLOR=darkblue]For[/COLOR] i = 1 [COLOR=darkblue]To[/COLOR] 50
      Application.Speech.Speak ("Danger")
   [COLOR=darkblue]Next[/COLOR] i
   
   [COLOR=green]'abort or continue[/COLOR]
errExit:
   [COLOR=darkblue]If[/COLOR] MsgBox("Continue", vbYesNo) = vbNo [COLOR=darkblue]Then[/COLOR]
      [COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
   [COLOR=darkblue]Else[/COLOR]
      [COLOR=darkblue]Resume[/COLOR] [COLOR=darkblue]Next[/COLOR]
   [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
End [COLOR=darkblue]Sub[/COLOR]

This is different than what I was imagining, but a lot cooler in some ways. I seriously appreciate this.
 
Upvote 0
Also have a look here at playing ...basically any sound you like, based on a WAV file

Code:
http://www.cpearson.com/excel/PlaySound.aspx
 
Upvote 0

Forum statistics

Threads
1,203,683
Messages
6,056,728
Members
444,887
Latest member
cvcc_wt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top