Hi, Posting this for searchable info, and in case any offer of explanation of, or better workaround/fix ?


You can get into state where you get :: Microsoft Excel "Document not saved" window displayed,
and so unable to save without closing / reopening workbook, as a result of having workbook changing code run in a BeforeSave event.

E.g.

If for some reason you wish to more manually control a Save As then you might have code such as

Please Login or Register  to view this content.
Whilst this will run okay, the workbook is then in a state where any attempt to Save e.g. Ctrl-S results in the Microsoft Excel "Document not saved" window and fails to save, and has to be closed and re-opened to make further changes.

This is the result of having Workbook changing code being run after your own ThisWorkbook.SaveAs .
i.e. ThisWorkbook.ActiveSheet.Range("A1").Value = "BS " & CStr(Now()) in above example


However it appears that the Workbook_AfterSave event is triggered with parameter Success=False , due to the Cancel=True processing.
This means that the following can achieve the post save workbook content alteration and does not cause this problematic state.

E.g.

Please Login or Register  to view this content.

Hope this is useful, please post any additional info..