To schedule an event relative to the current time - for example, 20 minutes from now : TimeValue « Date Functions « VBA / Excel / Access / Word






To schedule an event relative to the current time - for example, 20 minutes from now

 
Sub Main()
    Application.OnTime Now + TimeValue("00:20:00"), "DisplayAlarm"
End Sub
Sub DisplayAlarm()
    Beep
    MsgBox "Wake up. It's time for your afternoon break!"
End Sub

 








Related examples in the same category

1.TimeValue(time) returns A Variant/Date containing the time for time
2.TimerValue function returns time value
3.TimeValue("9:00") returns 9:00:00 AM
4.Program an event for 3:00 p.m.:
5.Scheduling a Verbal Reminder