OnTimer Procedure to trigger Macro at intervals

imported_unknown

Active Member
Joined
Jan 13, 2002
Messages
424
G'day ppl,

Does n e 1 know the correct procedure so as 2 get the TimerEvent 2 trigger every 30 mins or so.

I know I can use the Autosave, but it is limited and doesn't give me the result I need as I have 2 save 2 multiple locations.

I am aware of the OnTime Code to run a sub code at a given time of day, but that isn't enuf, I need it 2 repeat every 30 mins.

Sumthin like this:

Sub()
DoCmd.OnTimer 30000
Application.Run "SaveMyWorkBook"
End Sub.

N E suggestion or comments most welcomed.

TIA

Mark.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Use this method:

Application.OnTime Now + TimeValue("00:30:00"), "SaveMyWorkBook"

Put it in your Workbook_Open event procedure and again in your Workbook_BeforeSave event procedure.
 
Upvote 0
help its not working correctly?

Im trying to get my workbook in excel to save it self evey 10min, I know it down as seconds at the bottom due to me trying to test it and to get it working, I dont have time to wait 10min between each one to test this. the 1st save works when I open my work book, but the 2nd save never happens?

How do I get it to keep repeating the code so it saves it evey so often?


This Workbook
Private Sub Workbook_Open()

Application.OnTime Now + TimeValue("00:00:10"), "SaveBook"

End Sub

Module1
Sub SaveBook()

ActiveWorkbook.Save

End Sub


Private Sub Workbook_BeforeSave()

Application.OnTime Now + TimeValue("00:00:10"), "SaveBook"

End Sub

Thanks for any help given :)
 
Upvote 0

Forum statistics

Threads
1,218,945
Messages
6,145,372
Members
450,612
Latest member
OVSD_DS

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
Back
Top