MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Run Macro on computer time


Posted by Duncan on February 15, 2001 1:47 AM

I am hoping that someone may be able to tell me how I can run a macro everytime the computers clock ticks by a half hour - so it runs at 9:30, 10:00 , 10:30 etc...
Cheers


Posted by Dave Hawley on February 15, 2001 2:22 AM


Hi Duncan

This code will run every 30 mintutes from time of opening.

Private Sub Workbook_Open()
Application.OnTime EarliestTime:=Now, _
Procedure:="ResetCode"
End Sub

Sub MyCode()
MsgBox Time
Application.OnTime EarliestTime:=Now, _
Procedure:="ResetCode"
End Sub
Sub ResetCode()
Application.OnTime Now + TimeValue("00:30:00"), "MyCode"
End Sub


Dave

OzGrid Business Applications