Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off autosave in vba (Excel/OneDrive)

Tags:

excel

vba

I'm trying to turn off the autosave function for my excel document (Excel 365 while saving the file on OneDrive):

enter image description here

Doing a little research AutoRecover.Enabled = False (Application.) should be the right attribute but for some reason I can't get it to work. I don't get an error message, but the AutoSave Function does not turn off.

No luck with different objects (myWorkbook.AutoRecover.Enabled = False, etc.) either. Any Ideas what the problem might be?

like image 374
Albin Avatar asked Sep 30 '19 04:09

Albin


People also ask

How do I turn off AutoSave in Excel OneDrive?

If you want to turn AutoSave off, by default, for all files, go to File > Options > Save and uncheck the box next to AutoSave OneDrive and SharePoint Online files by default on <application>.


1 Answers

This code checks whether autosave in Excel 365 is on and, if so, turns it off. It displays messages indicating the status before and after the change.

Note: The below code only works for office 365 subscribers and in Excel 2016 or later

Sub ChkAutoSv()
Dim AutoSv As Boolean

    If Val(Application.Version) > 15 Then
        AutoSv = ActiveWorkbook.AutoSaveOn
        MsgBox "AutoSave set to: " & AutoSv
        If AutoSv Then ActiveWorkbook.AutoSaveOn = False
        AutoSv = ActiveWorkbook.AutoSaveOn
        MsgBox "AutoSave now set to: " & AutoSv
    End If
End Sub
like image 110
Any1There Avatar answered Sep 21 '22 13:09

Any1There