RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: Intermediate
Jan 3, 2020

How to Call a Macro Every "n" Minutes

We write a lot of macros to automate many of our mundane repeated tasks. Taking it to the next level, we can call the macro in a pre-determined frequency and get the macro triggered.

See below for an example:

Sub MainMacroMethod()
  ' Begin macro code
  ' This method contains the macro???s code.
  ' End macro code
'Call a method at the end that will set a timer
 Call timerMethod
 End Sub

Sub timerMethod ()
   'Set a timer that will trigger the above method in the next 6 minutes
    Application.OnTime Now + TimeValue("00:06:00"), "MainMacroMethod"
End Sub 
Srinath M S
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date