ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to code macro to close Excel Application? (https://www.excelbanter.com/excel-programming/438094-how-code-macro-close-excel-application.html)

Eric

How to code macro to close Excel Application?
 
Does anyone have any suggestions how to code macro to close Excel Application?
I have a macro coding, and would like to add code to close Excel Application
at the end of macro.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric

Jacob Skaria

How to code macro to close Excel Application?
 
Hi Eric

Try

Application.DisplayAlerts = False
Application.Quit

--
Jacob


"Eric" wrote:

Does anyone have any suggestions how to code macro to close Excel Application?
I have a macro coding, and would like to add code to close Excel Application
at the end of macro.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric


Benito Merino

How to code macro to close Excel Application?
 
On 7 ene, 11:33, Eric wrote:
Does anyone have any suggestions how to code macro to close Excel Application?
I have a macro coding, and would like to add code to close Excel Application
at the end of macro.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric


Hi Eric.

One way is application.quit

Regards,


Benito
Barcelona

Eric

How to code macro to close Excel Application?
 
Thank everyone very much for suggestions
If I close Excel application, will it save this file first before closing?
Does anyone have any suggestions how to edit the code to save the file first
before closing the application?
Thank everyone very much for any suggestions
Eric

"Jacob Skaria" wrote:

Hi Eric

Try

Application.DisplayAlerts = False
Application.Quit

--
Jacob


"Eric" wrote:

Does anyone have any suggestions how to code macro to close Excel Application?
I have a macro coding, and would like to add code to close Excel Application
at the end of macro.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric


Benito Merino

How to code macro to close Excel Application?
 
On 8 ene, 06:09, Eric wrote:
Thank everyone very much for suggestions
If I close Excel application, will it save this file first before closing?
Does anyone have any suggestions how to edit the code to save the file first
before closing the application?
Thank everyone very much for any suggestions
Eric

"Jacob Skaria" wrote:
Hi Eric


Try


Application.DisplayAlerts = False
Application.Quit


--
Jacob


"Eric" wrote:


Does anyone have any suggestions how to code macro to close Excel Application?
I have a macro coding, and would like to add code to close Excel Application
at the end of macro.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric


Hi.

If you want to save all the workbooks opened:

Sub quit()
For Each ws In Workbooks
a = ws.Name
ws.Save
Next
Application.quit
End Sub

If you want to save only the active workbook:

Sub quit()
ActiveWorkbook.Save
Application.quit
End Sub

Regards,

Benito
Barcelona
Spain



All times are GMT +1. The time now is 01:26 AM.

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