» Execute Command/Sub-Procedure Using Timer in VBA
CATEGORY - Date & Time in VBA
VERSION - All Microsoft Excel Versions
This example demostrates how to use a timer to call up a sub procedure after a specific set time has passed.TimeValue Function is used.
In this example, 3-seconds is assigned to the function.
The Application.OnTime alertTime statement is used to call up the sub procedure, msg, when 3-seconds is up.
Sub timerMsg()
Dim alertTime
MsgBox "The alarm will go off in 3 seconds!"
alertTime = Now + TimeValue("00:00:03")
Application.OnTime alertTime, "msg"
End Sub
Sub msg()
MsgBox "Three Seconds is up!"
End Sub
Book Store:
Recommended Books:
- Accounting the Easy Way
- AWAKEN THE GIANT WITHIN : HOW TO TAKE IMMEDIATE CONTROL OF YOUR MENTAL, EMOTIONAL, PHYSICAL AND FINANCIAL
- Windows XP Annoyances
- The McGraw-Hill 36-Hour Course in Finance for Nonfinancial Managers
- Microsoft Excel VBA Programming for the Absolute Beginner
- The 22 Immutable Laws of Branding
No comments have been submitted.

