I want the users to complete the tak and exit only through the command button which I have created on the worksheet. I have been trying with the following code, but it also stops when closing through command button (macros). Can any body help me on this?
This WorkBook Module
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If BooleanForClosing = False Then
Cancel = True
End If
End Sub
Sheet Module
Public BooleanForClosing As Boolean
Private Sub CommandButton1_Click()
BooleanForClosing = True
ThisWorkbook.Close (SaveChanges = Yes)
End Sub
Bookmarks