VBA to turn off AutoSave but not Save as it is actioned

micah1880

New Member
Joined
Oct 25, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I am currently using this VBA code to turn off AutoSave:

VBA Code:
    If Val(Application.Version) > 15 Then
        If ActiveWorkbook.AutoSaveOn Then ActiveWorkbook.AutoSaveOn = False
    End If

Every time this code is run the file will Save before I can carry on.

This is a large file so this Save is time consuming, and I would like to by-pass it.

Please can you advise if there is some VBA code I can add that will prevent the Save after AutoSave is turned off?

Thanks
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
It seems that ThisWorkbook.Saved = True won't prevent a save when turning off autosave. All I can think of is that you create a public variable and if autosave is on, set its value to False (or whatever you want). Then use the workbook beforesave event to check the variable and Cancel save in that event. Someone else might have a better idea.
 
Upvote 0

Forum statistics

Threads
1,223,731
Messages
6,174,173
Members
452,548
Latest member
Enice Anaelle

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