This in the Thisworkbook code module:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If OkToClose Then Cancel = True
End Sub
OkToClose is a boolean global variable which you create and is set to
False most of the time (especially on opening the workbook!). The only
time it's set to True is in the code for your exit buttons.