P
Paul D.
I want to force users to close the Excel Application using a CloseButton on a
UserForm rather than the X button, so I have the following code:
In the ThisWorkbook Module:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If CloseMode = vbFormControlMenu Then
Cancel = True
Open_Switchboard 'name of UserForm
End If
End Sub
In the Userform:
Private Sub cmdCloseButton_Click()
Application.Quit
End Sub
When I click the CloseButton on the UserForm, nothing happens. If I remove
the code from "Private Sub Workbook_BeforeClose(Cancel As Boolean)" then the
application quits when I click the CloseButton.
Why is that? Is this a bug in Excel 2007? Any help?
UserForm rather than the X button, so I have the following code:
In the ThisWorkbook Module:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If CloseMode = vbFormControlMenu Then
Cancel = True
Open_Switchboard 'name of UserForm
End If
End Sub
In the Userform:
Private Sub cmdCloseButton_Click()
Application.Quit
End Sub
When I click the CloseButton on the UserForm, nothing happens. If I remove
the code from "Private Sub Workbook_BeforeClose(Cancel As Boolean)" then the
application quits when I click the CloseButton.
Why is that? Is this a bug in Excel 2007? Any help?