Heylo, How is your office life going on? I pray for all of you and wish you lots of wealth and a very good health. Coming to our topic, we're actually gonna discuss Application.OnTime Object of Application class.
For details: Please visit Microsoft MSDN here:
We used Now + TimeValue(time) in our example to schedule something to be run when a specific amount of time (counting from now) has elapsed as TimeValue(time) is used to schedule something to be run a specific time.
1. This example runs my_Procedure 15 seconds from now.
Application.OnTime Now + TimeValue("00:00:15"), "my_Procedure"
2. This example runs my_Procedure at 5 P.M.
Application.OnTime TimeValue("17:00:00"), "my_Procedure"
Application.OnTime Now + TimeSerial(0, 1, 0), "AlarmMacro"
'This should be the macro that runs after one minute
'We simply pops up a message box.
MsgBox "The code was just executed!"