Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to code macro to close Excel Application?

2 views
Skip to first unread message

Eric

unread,
Jan 7, 2010, 5:33:01 AM1/7/10
to
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

unread,
Jan 7, 2010, 5:52:38 AM1/7/10
to

Hi Eric.

One way is application.quit

Regards,


Benito
Barcelona

Jacob Skaria

unread,
Jan 7, 2010, 5:49:01 AM1/7/10
to
Hi Eric

Try

Application.DisplayAlerts = False
Application.Quit

--
Jacob

Eric

unread,
Jan 8, 2010, 12:09:01 AM1/8/10
to
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

Benito Merino

unread,
Jan 8, 2010, 2:51:04 AM1/8/10
to

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

0 new messages