I want to disable close button of workbook and allow closure through macro. I have tried several methods including the simplest of all codes:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
End Sub
It works once but second time I click on the close button, it asks standard question (Save, Don't Save, Cancel).
I have another question: When I close through Macro, will Workbook_BeforeClose(Cancel As Boolean) not interfere?
Simplified version of Macro for closing workbook is :
Sub myClose()
.....
.......
.......
ThisWorkbook.Save
Application.Quit
End Sub
Need Help.