Hi all
I have seen a few threads on this topic and have applied the basic below code in to the object "ThisWorkbook". It unfortunately only works for the first click and once dismissing the message box has occurred the close (x) button can then be pushed and operates as normal.
I would like to completely disable closing the workbook in this manner and rather direct the user to a button to close the workbook.
Here is my code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
MsgBox "Please use the 'Save and Close' button on Sheet 1"
End Sub
The interesting thing is that it will work for infinite clicks only if I have 2 workbooks open with both of them having the above code in the "ThisWorkbook" object?!
Please note I want this to prevent a close of the workbook and NOT A USER FORM.
Thanks in advance
Bookmarks