I have been having issues with co-authoring where a yellow alert banner pops up indicating that autosave has been switched off and is unable to be switched back on. Not everyone in the group notices this when it happens causing some changes to be lost.
I am aiming to have the workbook check if autosave is on every time there is a change in the sheet. The aim is also to switch it back on when possible or to proceed to the error handler and prompt the user to close and re-open the sheet when it is not able to do so.
However, I cannot seem to get it to work, the msgbox does not display when this happens. Below is the subroutine.
Public Sub CheckAutoSave() 'add to Thisworkbook sheetchange
With ActiveWorkbook
If .AutoSaveOn = False Then
.AutoSaveOn = True
On Error GoTo AutoSaveErrHandler
GoTo SkipErrHandler
AutoSaveErrHandler:
MsgBox "AutoSave failed to turn on, Re-open file.", vbOKOnly
SkipErrHandler:
End If
End With
End Sub
Put the On Error
statement an the beginning of your Sub. Here's a cleaned up revision of your code:
Public Sub CheckAutoSave() 'add to Thisworkbook sheetchange
On Error GoTo AutoSaveErrHandler
With ActiveWorkbook
If Not .AutoSaveOn Then
.AutoSaveOn = True
End If
Exit Sub
End With
AutoSaveErrHandler:
MsgBox "AutoSave failed to turn on, Re-open file.", vbOKOnly
End Sub
If this still doesn't catch the error, hit the Debug button on the message and clarify where it's pointing to in the code.