View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Application.Quit Not Working in Office 2007

Try saving the workbook..

ThisWorkbook.Save
Application.Quit

If this post helps click Yes
---------------
Jacob Skaria


"Carl" wrote:

I have used the following code to shut down Excel 2003 when the workbook is
closed but now that I am using Excel 2007 it no longer closes Excel, only the
active workbook. I have tried everything to no avail and have the same
results whether the workbook is in 2003 or 2007 format. Thanks in advance,
Carl

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim oCtrl As Office.CommandBarControl
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = True
Next oCtrl
Application.DisplayFullScreen = False
Application.Quit
End Sub