» Execute Command/Sub-Procedure Using Timer in VBA
CATEGORY: Date & Time in VBA |
VERSIONS: 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 |
Execute Command/Sub-Procedure Using Timer in VBA
rdwray@isp.com wrote on December 31, 1969 19:00 EST
Took you code and pasted into excel after trying my own and cannot get either one to work in 2002.
Book Store:
Recommended Books:
- Financial Statements: A Step-By-Step Guide to Understanding and Creating Financial Reports
- What the IRS Doesn't Want You to Know: A Cpa Reveals the Tricks of the Trade
- Absolute Beginner's Guide to Microsoft Office Excel 2003
- Finance and Accounting for Nonfinancial Managers
- Marketing Plans That Work, Targeting Growth and Profitability
- Windows XP for Dummies
Related MS EXCEL TIPS:
Terms
and Conditions of use
The applications/code on this site are distributed as is and without warranties
or liability. In no event shall the owner of the copyrights, or the authors
of the applications/code be liable for any loss of profit, any problems
or any damage resulting from the use or evaluation of the applications/code.






the .OnTime is highlighted and a message comes up saying:
Method or data member not found