View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Carl Carl is offline
external usenet poster
 
Posts: 361
Default Application.Quit Not Working in Office 2007

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