devxlogo

How to Call a Macro Every “n” Minutes

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 SubSub 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 
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist