Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ZAK ZAK is offline
external usenet poster
 
Posts: 6
Default Displaying a Message and a Beep

Hi

Does anyone knwo how to display a message and set
continuous beeps at certain intervals.

I used message box but the problem is it waits for on to
click on the OK button, only then it proceeds to do the
beeps.

I want that happening simultaneously. Think mulitthreading
might be required here.

Regards

Yamin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Displaying a Message and a Beep

Yamin,

To beep while a message is displayed, you'll need to
create UserForm and a procedure in a code Module.

To learn more about the techniques I have used, you
should look into the Application.OnTime method
and learn about UserForms.

Here's a step-by-step.

1. Start Excel with an empty workbook
2. Activate Visual Basic Editor by pressing Alt+F11
3. Insert - Module
4. Enter this code:

Dim BeepTime As Date

Sub BeepNow()
Beep
BeepTime = Now + TimeValue("00:00:01")
Application.OnTime _
EarliestTime:=BeepTime, _
Procedu="BeepNow", _
Schedule:=True
End Sub

Sub UnBeep()
Application.OnTime _
EarliestTime:=BeepTime, _
Procedu="BeepNow", _
Schedule:=False
End Sub

Sub ShowWarning()
UserForm1.Show
End Sub

5. Insert - UserForm

6. In the properties window (press F4 if you don't see it) change
the Caption of the UserForm to "Coffeine level warning"

7. Use the Toolbox to add a label and a CommandButton to your
form. Change the caption of the label to "You have missed your
coffee break" and the caption of the commandbutton to "OK"

8. Double-click anywhere on the form and add this code:

Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub UserForm_Initialize()
Call BeepNow
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Call UnBeep
End Sub


Now you are done. Press Alt+F11 to return to Excel.
Run the ShowWarning procedure (Tools - Macro - Macros...).
Happy?


Ture Magnusson
Karlstad, Sweden


"ZAK" wrote in message
...
Hi

Does anyone knwo how to display a message and set
continuous beeps at certain intervals.

I used message box but the problem is it waits for on to
click on the OK button, only then it proceeds to do the
beeps.

I want that happening simultaneously. Think mulitthreading
might be required here.

Regards

Yamin



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
If Formula for displaying a message Sherees Excel Discussion (Misc queries) 9 January 16th 10 12:12 PM
Stop displaying a message because of a formula Urgent Help Excel Worksheet Functions 2 April 10th 09 07:29 PM
BEEP ziad Excel Discussion (Misc queries) 5 December 28th 07 03:56 PM
Beep accompanying My Message Box JMay Excel Discussion (Misc queries) 9 February 7th 07 11:49 AM
Displaying an error message if entries exceed 100% KG Excel Discussion (Misc queries) 11 April 5th 06 03:03 PM


All times are GMT +1. The time now is 11:19 AM.

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

About Us

"It's about Microsoft Excel"