Setting timer to run macro at regular intervals

  • Thread starter Thread starter sun
  • Start date Start date
S

sun

Dear Excel Gurus,

Can I set a timer to run a macro at regular time intervals? Is there a
convenient API to use?

Thank you very much in advance.
 
Hi,

You can us Ontime

This goes in the workbook open event module to kick things off

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

and this goes in a general module

Public dTime As Date
Sub MyMacro()
dTime = Now + TimeValue("00:01:00")
Application.OnTime dTime, "MyMacro"

'Your code

End Sub

As written this runs MyMacro every 1 minute, change this to what you want

Mike
 
In Windows 2003, Go to Start>All Programs>Accessories>System Tools>Scheduled
Tasks. Then click on the folder icon to bring up the scheduled tasks wizard.
This will allow you to start Excel programs without having to open Excel or
a Workbook. Just follow the Wizard prompts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Alarm Timer 3
Stop my timer 4
Stopping a timer 10
Static variable 1
Timer in Excel 5
Read MHT file using macro 0
Automatically clear web query message "unable to open http:" 1
Predictive Model Needs Macro Timer! 4

Back
Top