ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code to Quit App Doesn't Work (https://www.excelbanter.com/excel-programming/416256-code-quit-app-doesnt-work.html)

Sheldon

Code to Quit App Doesn't Work
 
Hello -

I have a workbook that automatically imports tables from a database via code
and is set with the Windows scheduler.

When it's done importing, I want it to close the workbook and quit the
application. At the end of the import code, I placed the following:

ActiveWorkbook.Close
Application.Quit

It doesn't close and the application doesn't quit. How can I get it to do
that?
--
Sheldon

Bob Thompson

Code to Quit App Doesn't Work
 
Try
Lose the ActiveWorkbook.Close
Just use Application.Quit

"Sheldon" wrote:

Hello -

I have a workbook that automatically imports tables from a database via code
and is set with the Windows scheduler.

When it's done importing, I want it to close the workbook and quit the
application. At the end of the import code, I placed the following:

ActiveWorkbook.Close
Application.Quit

It doesn't close and the application doesn't quit. How can I get it to do
that?
--
Sheldon


Don Guillett

Code to Quit App Doesn't Work
 
This may be of help

Sub SaveAllAndQuit()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each wb In Application.Workbooks
wb.Save
Next wb
Application.Quit
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sheldon" wrote in message
...
Hello -

I have a workbook that automatically imports tables from a database via
code
and is set with the Windows scheduler.

When it's done importing, I want it to close the workbook and quit the
application. At the end of the import code, I placed the following:

ActiveWorkbook.Close
Application.Quit

It doesn't close and the application doesn't quit. How can I get it to do
that?
--
Sheldon




All times are GMT +1. The time now is 11:45 AM.

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