I am trying to force users to exit with a button that I've placed on a
worksheet. I would like to disable the X button on the Window-pane, but
I can't quite figure out how. I've accomplished this in Userforms using
this logic:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then Cancel = True
End Sub
But I can't quite find the equivalent for a workbook. Excel doesn't
seem to recognize a Workbook_QueryClose event. And I have been unable
to come up with an equivalent for CloseMode or vbFormControlMenu for
that will return any values in the Workbook_BeforeClose event.