Hi
I have this code;
The challenge I have is around prompts on saving. If person A and person B are in the shared book, and, person A closes the book then the above code works fine. If person B then closes the book, the save prompt still appears (but the above code says to save if not saved so not sure why this is happening).
I recognize (from my own learning on the topic so far) that between person A closing and person B closing, that things have happened in the background hence the prompt to save. However, is there a way around this so that it saves regardless / on every time without prompt?
Any help would be massively appreciated.
Thanks
Ben
I have this code;
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim wsSheet As Worksheet
For Each wsSheet In Worksheets
wsSheet.Visible = xlSheetVisible
If wsSheet.Name <> "Cover Page" Then
wsSheet.Visible = xlSheetVeryHidden
End If
Next wsSheet
If ThisWorkbook.Saved = False Then
ThisWorkbook.Save
End If
End Sub
The challenge I have is around prompts on saving. If person A and person B are in the shared book, and, person A closes the book then the above code works fine. If person B then closes the book, the save prompt still appears (but the above code says to save if not saved so not sure why this is happening).
I recognize (from my own learning on the topic so far) that between person A closing and person B closing, that things have happened in the background hence the prompt to save. However, is there a way around this so that it saves regardless / on every time without prompt?
Any help would be massively appreciated.
Thanks
Ben