ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to close Excel 2007 (https://www.excelbanter.com/excel-discussion-misc-queries/218609-macro-close-excel-2007-a.html)

Ralph

Macro to close Excel 2007
 
How do I close out of Excel completely? I've tried this:
Sub Macro1()
'
' Macro1 Macro
' Save and close workbook
'
ActiveWorkbook.Save
ActiveWorkbook.Close

this only closes the active workbook and I need to close Excel completely.

thanks

Ralph

Macro to close Excel 2007
 
ActiveWorkbook.Application.Quit

Seems to do the trick.

"Ralph" wrote:

How do I close out of Excel completely? I've tried this:
Sub Macro1()
'
' Macro1 Macro
' Save and close workbook
'
ActiveWorkbook.Save
ActiveWorkbook.Close

this only closes the active workbook and I need to close Excel completely.

thanks


Gord Dibben

Macro to close Excel 2007
 
Sub Macro1()

ActiveWorkbook.Save
Application.Quit

End Sub


Gord Dibben MS Excel MVP

On Sat, 31 Jan 2009 10:49:02 -0800, Ralph
wrote:

How do I close out of Excel completely? I've tried this:
Sub Macro1()
'
' Macro1 Macro
' Save and close workbook
'
ActiveWorkbook.Save
ActiveWorkbook.Close

this only closes the active workbook and I need to close Excel completely.

thanks




All times are GMT +1. The time now is 12:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com