ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there a function for closing Excel using VB? (https://www.excelbanter.com/excel-programming/335554-there-function-closing-excel-using-vbulletin.html)

Norm

Is there a function for closing Excel using VB?
 
I have created a macro that saves the current worksheet to a specified
location with a specified name and then closes the worksheet. I would like
to be able to close the Excel application itself from the macro.

Can anyone tell me how?

Dave Patrick

Is there a function for closing Excel using VB?
 
Application.Quit

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Norm" wrote:
|I have created a macro that saves the current worksheet to a specified
| location with a specified name and then closes the worksheet. I would
like
| to be able to close the Excel application itself from the macro.
|
| Can anyone tell me how?



Norm

Is there a function for closing Excel using VB?
 
Thanks Dave.

Funny thing is that Application.Quit does not work if it is preceeded by
ActiveWorkbook.Close



"Dave Patrick" wrote:

Application.Quit

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Norm" wrote:
|I have created a macro that saves the current worksheet to a specified
| location with a specified name and then closes the worksheet. I would
like
| to be able to close the Excel application itself from the macro.
|
| Can anyone tell me how?




Dave Patrick

Is there a function for closing Excel using VB?
 
Once the workbook is closed the code that is/was running terminates. You
shouldn't need that line.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Norm" wrote:
| Thanks Dave.
|
| Funny thing is that Application.Quit does not work if it is preceeded by
| ActiveWorkbook.Close




All times are GMT +1. The time now is 07:26 PM.

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