Use the OnTime method to run a VBA procedure on a particular day: runs the DisplayAlarm procedure at 5:00 p.m. on December 31, 2007: : DateValue « Date Functions « VBA / Excel / Access / Word
Use the OnTime method to run a VBA procedure on a particular day: runs the DisplayAlarm procedure at 5:00 p.m. on December 31, 2007:
Sub Main()
Application.OnTime DateValue("12/31/2007 5:00 pm"), "DisplayAlarm" End Sub Sub DisplayAlarm()
Beep
MsgBox "Wake up. It's time for your afternoon break!" End Sub