Application.Quit doesn't work

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
626
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)    
    Dim sh As Worksheet
             
    Application.DisplayAlerts = False
    For Each sh In ThisWorkbook.Sheets
        Select Case sh.Name
            Case "Exhibit " & """I"" ", "page 2"
                Call deleteWS
        End Select
    Next
    Application.DisplayAlerts = True
    ThisWorkbook.Saved = True
    Application.ActiveWorkbook.Close
    Application.Quit
End Sub
This Code will do everything as expected except the last line.
Code:
Application.Quit
For whatever reason it won't shutdown/quit excel. It just closes the workbook.
I am running 2010 Office University version, if that helps. Thank You.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Once you close the workbook, you also close/stop any VBA procedures contained it that workbook.
So if this procedure is in that workbook, it will never get to that line of code.

If you just want to quit Excel, remove the "Application.ActiveWorkbook.Close" line. That will be unnecessary, as quitting the application will automatically close the workbook too.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top