Having a macro run automatically every 15 minutes


Posted by Matt on June 11, 2001 9:05 AM

I have a somewhat workable block of code below, but am certain that there is a better way of writing this. I would like to open my workbook, click on my macro button (currently assigned to the below AutoUpdate macro) and then have it run in the background and call another subroutine automatically every 15 minutes. Any suggestions? Thanks!


Sub AutoUpdate()

Do

Application.Wait (Now + TimeValue("00:15:00"))

Call RefreshDataAndTables

Loop

End Sub



Posted by George Clements on June 11, 2001 9:58 AM

:Try the following in the Thisworkbook module

Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:15:00"), "RefreshDataAndTables"
End Sub

This should then automatically run every 15 minutes. The calling macro will be activated when the workbook is opened and will run your macro "RefreshDataAndTables" every 15 mins.