» Execute Command/Sub-Procedure Using Timer in VBA
CATEGORY - Date & Time in VBA
VERSION - All Microsoft Excel Versions
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 Principles, with CD, 6th Edition
- The Complete Book of Business Plans: Simple Steps to Writing a Powerful Business Plan (Small Business Sourcebooks)
- Special Edition Using Microsoft Office XP
- The Financial Numbers Game: Detecting Creative Accounting Practices
- Windows XP for Dummies
- Word 2002: The Complete Reference
Execute Command/Sub-Procedure Using Timer in VBA
rdwray@isp.com
Took you code and pasted into excel after trying my own and cannot get either one to work in 2002.
Re: Execute Command/Sub-Procedure Using Timer in VBA
LLA
Hi there,
I have got a problem with this simple procedure, cause it can't find the way of the second one (named : msg).
The procedure timeMsg is perfect, but when it's arrived at "Application.OnTime alertTime, "msg", it is the bug!!!
This one is just above in my thisWorkbook.
Is someone can help me?
Many thanks to you.
LLA
Re: Execute Command/Sub-Procedure Using Timer in VBA
shg
Welcome to the forum.
Please take a few minutes to read the forum rules, and then start your own thread in one of the question forums. This isn't one.
Thanks.


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