How to avoid Excel save pop-up
During workbook close, how to avoid excel save, don't save pop-up.
We already fool the excel by telling it, we saved.. But still the pop-up is throwing.
It is not coming for all excels we have. I have a .xlsm file, only for which it is coming. Sorry that I can't able to share my program.
Following is my workbook close event in vba.
Private Sub App_WorkbookBeforeClose(ByVal wb As Excel.Workbook, Cancel As Boolean)
My code
wb.saved = True
End Sub
I also tried Activeworkbook.Saved = True, Thisworkbook.Saved = True, nothing is working fine..
Please leave your inputs to solve this.
That code is working fine for many years. Only with the .xlsm file which we have now, the pop-up is coming. I wish to share the excel, but I can't due to some restriction. I know making false to .EnableEvents and .DisplayAlerts will prevent this. But I cannot give that as a workaround,
try this
Hello,
You could try one of the line above. Use it before "End Sub":
ActiveWorkbook.Close True - close workbook with save
ActiveWorkbook.Close False - close without save
Thanks But
Activeworkbook.close will again call our Appclose() method, and since we remove all the reference when closing, second time when it is called, it results in Object variable not set error.