Program an event for 3:00 p.m.: : TimeValue « Date Functions « VBA / Excel / Access / Word






Program an event for 3:00 p.m.:

 
Sub main()
    Application.OnTime TimeValue("3:00:00 pm"), "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.To schedule an event relative to the current time - for example, 20 minutes from now
5.Scheduling a Verbal Reminder