How to turn off an autosave macro once it's been started? - VBA

DCpics

New Member
Joined
Apr 26, 2012
Messages
26
I have a person that gave me their spreadsheet which they use for manufacturing production. At the start of a shift, the shift supervisor presses a "Start of Shift" button. They asked me to place an autosave macro in there so it backs up throughout the day. I put the following macro in:

Sub AutoSave()
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = True

Application.OnTime Now + TimeValue("00:10:00"), "AutoSave"
End Sub

They have added an "End of Shift" button and it has things it does when they press that. They have asked me to turn off the autosave function when that button is pressed.

How do I turn off the macro? I can't figure out how to deactivate it.

Thank you for your help.

Mike
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi,
Try these macros to switch autosaving On/Off:
Rich (BB code):
Option Explicit
 
Dim SaveDateTime As Date
 
Sub AutoSaveOn()
  ThisWorkbook.Save
  SaveDateTime = Now + TimeValue("00:10:00")
  Application.OnTime SaveDateTime, "AutoSaveOn"
End Sub
 
Sub AutoSaveOff()
  Application.OnTime SaveDateTime, "AutoSaveOn", Schedule:=False
End Sub
Regards
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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