mdfreeman
New Member
Hi!
Goal - open file that is on SharePoint and ensure that even those with permission to change file, do not mistakenly "Auto-Save" over the original file.
I have pulled together code that works to check if a file is set to "Auto-Save" in o365 that works.
Now I have placed in into an "On Open" Event since auto save settings are tied to the user and not the file.
The testing file is saved to SharePoint.
I have placed the following code in the "This Worksheet" and it does not work.
I have placed MsgBox into the VBA to see if the code is triggered. It doesn't seem to be.
Thoughts on what I am doing wrong?
Thank you in advance for reviewing the code.
Mark
Goal - open file that is on SharePoint and ensure that even those with permission to change file, do not mistakenly "Auto-Save" over the original file.
I have pulled together code that works to check if a file is set to "Auto-Save" in o365 that works.
Now I have placed in into an "On Open" Event since auto save settings are tied to the user and not the file.
The testing file is saved to SharePoint.
I have placed the following code in the "This Worksheet" and it does not work.
I have placed MsgBox into the VBA to see if the code is triggered. It doesn't seem to be.
Thoughts on what I am doing wrong?
Thank you in advance for reviewing the code.
Mark
Code:
Private Sub Workbook_Open()
''https://stackoverflow.com/questions/58161421/turn-off-autosave-in-vba-excel-onedrive
MsgBox "On Open Code Has Started"
Dim AutoSv As Boolean
If Val(Application.Version) > 15 Then
AutoSv = ActiveWorkbook.AutoSaveOn
If AutoSv = True Then
If IsNumeric(InStr(Excel.ActiveWorkbook.Path, "/Shared Documents/Dept_")) Then
MsgBox "AutoSave is current on and will now be turned off." & Chr(10) & Chr(10) & "Yout can re-enable on your personal copy of the forecast template."
ActiveWorkbook.AutoSaveOn = False
End If
End If
End If
End Sub