Automate a function to run every ... minutes

RCMetrics

Board Regular
Joined
Oct 28, 2005
Messages
95
Is there a way to automate a function to run itself every 15 minutes or any time frame we would like?


Say I have the following:

MsgBox "Import Data from order Desk", vbInformation, "Reminder"


What should I do to get this msgbox to popup evey 15 minutes...

Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
Take a look at the Application.OnTime event. It lets you define a set interval for running whatever function you need.

Denis
 
Upvote 0

RCMetrics

Board Regular
Joined
Oct 28, 2005
Messages
95
Doesn't look like "ontime" is a selectable option in the dropdown menu after "appplication."

any idea why...?

can some one do one quick example and a dummy function such as open query and show me what the VB look like?

Thanks.
 
Upvote 0

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
Sorry, gave you the wrong info. I was thinking about Excel.

What you do is set up a form (which can be hidden, but need to load on startup). In the form's properties there is a Timer property. Default is 0, meaning the timer is off. To set a 15 minute interval, enter 00:15:00

Then, in the form's OnTimer event, set a trigger to run your message and/or the query. Something like:

Code:
Private Sub Form_Timer ()
    MsgBox "Time's Up!"
    DoCmd.OpenQuery "YourQueryNameHere"
End Sub
Denis
 
Upvote 0

Forum statistics

Threads
1,195,625
Messages
6,010,754
Members
441,568
Latest member
abbyabby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top