ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Close and Exit Excel (https://www.excelbanter.com/excel-programming/276356-re-close-exit-excel.html)

Stephan Kassanke

Close and Exit Excel
 
Jeff wrote:
I don't know if there is a statement in VBA to close and
exit Excel. I am able to close my workbook using
the 'close' statement, but I leaves excel running. I
would like a complete exit of excel and have the machine
return to the desktop


Application.Quit?

cheers,
Stephan.



Stephan Kassanke

Close and Exit Excel
 
Jeff wrote:
Application.quit closes the file but leaves excel running,
as well as the VB editor, although the editor may be
incidental, due to my use of the editor.


Hmm, I just tried it and Application.Quit closes all workbooks *and*
terminates Excel on my machine. The help documents gives the following
sample which should save all workbooks and close Excel afterwards. And
that's excactly what the fragment does (on my machine).

For Each w In Application.Workbooks
w.Save
Next w
Application.Quit
Sorry, I guess that doesn't really help you.


cheers,
Stephan



Jeff[_20_]

Close and Exit Excel
 

-----Original Message-----
Jeff wrote:
Application.quit closes the file but leaves excel

running,
as well as the VB editor, although the editor may be
incidental, due to my use of the editor.


Hmm, I just tried it and Application.Quit closes all

workbooks *and*
terminates Excel on my machine. The help documents gives

the following
sample which should save all workbooks and close Excel

afterwards. And
that's excactly what the fragment does (on my machine).

For Each w In Application.Workbooks
w.Save
Next w
Application.Quit
Sorry, I guess that doesn't really help you.


cheers,
Stephan


.
Thanks for the Help.

I will investigate my machine(s). Have three and only
tried it on the oldest. Thanks again for the help, and
ignore the next post from me!

Good Hunting
Jeff

Tom Ogilvy

Close and Exit Excel
 
In Excel VBA working in the current instance of Excel,

Application.Quit

will close all workbooks and close Excel.

If you are calling it from using Excel as an automation server, then if
there is an existing reference to Excel that hasn't been released, excel
will continue to be visible in the task manager.

In the first case, there may be things that could cause Excel not to close,
but the normal behavior is for Excel to close.

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...

-----Original Message-----
Jeff wrote:
I don't know if there is a statement in VBA to close

and
exit Excel. I am able to close my workbook using
the 'close' statement, but I leaves excel running. I
would like a complete exit of excel and have the

machine
return to the desktop


Application.Quit?

cheers,
Stephan.


.

Application.quit closes the file but leaves excel running,
as well as the VB editor, although the editor may be
incidental, due to my use of the editor.





All times are GMT +1. The time now is 04:01 PM.

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