LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Application.Quit in Excel 2007

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?


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Application.Quit problem [email protected] Excel Programming 0 January 17th 07 08:46 PM
Excel.Application.Quit() Mircea Pleteriu Excel Programming 1 March 8th 05 03:03 PM
Excel.Application.Quit() method Mircea Pleteriu Excel Programming 0 March 8th 05 02:39 PM
Excel application does not quit Gena Excel Programming 0 October 29th 04 06:17 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM


All times are GMT +1. The time now is 03:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"