Setting Cancel=True in Workbook.BeforeSave subroutine doesn't appear to work in compiled. Any workaround ideas?

StevegHI

Member
I'm on 2025.2 with Windows/10 and have a complex Excel spreadsheet. However, when I try to save, I need the option to cancel it in the Workbook.BeforeSave subroutine.

Setting Cancel=True end exiting the subroutine doesn't cancel the save. It works in the xlsm version but not in the compiled version. Tracing the program shows it executes the Workbook.BeforeSave routine with Cancel=True and goes into the AfterSave Workbook.AfterSave subroutine. After exiting that routine, it brings up a window titled "Save local workbook." For your information, I use XLSPadlock_OnAfterSave but even disabling that makes no difference.

I still get the save window (attachment) and XLSPadlock tries to save the file. Need to get this going as soon as possible or will have to reprogram a different save mechanism. (Can upload a zip file with sample source if anybody's interested.)

Anybody have an idea of a work around? Hate to make a separate button for Save.
 
Back
Top