Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Force Excel to close

I am running some automated reports and using a batch file to run them in
sequence, one issue I am having is forcing each report to close after it is
complete, the command I am using is

application.quit but this seems to be very flaky, is there a better way to
force excel to close when the report is complete

thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Force Excel to close

Application.Quit is the appropriate method of closing the application.
However, certain protocol should be followed in using it. Be sure that all
files for that instance of the application are closed before before
executing the Quit command. To avoid error or run time messages, when
closing the files, establish their saved status. Either save them, use the
Saved = True or SaveChanges = False to avoid the messages. A review of the
VBA help file on these topics might provide additional assistance.


"Nigel" wrote in message
...
I am running some automated reports and using a batch file to run them in
sequence, one issue I am having is forcing each report to close after it
is
complete, the command I am using is

application.quit but this seems to be very flaky, is there a better way to
force excel to close when the report is complete

thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Force Excel to close

I have this at the end of the code

ThisWorkbook.Save
application.Quit

the workbook is saving but excel is not closing,

if I do this

thisworkbook.save
thisworkbook.close

and then on the before close event

application.quit

it seems to work fine

"JLGWhiz" wrote:

Application.Quit is the appropriate method of closing the application.
However, certain protocol should be followed in using it. Be sure that all
files for that instance of the application are closed before before
executing the Quit command. To avoid error or run time messages, when
closing the files, establish their saved status. Either save them, use the
Saved = True or SaveChanges = False to avoid the messages. A review of the
VBA help file on these topics might provide additional assistance.


"Nigel" wrote in message
...
I am running some automated reports and using a batch file to run them in
sequence, one issue I am having is forcing each report to close after it
is
complete, the command I am using is

application.quit but this seems to be very flaky, is there a better way to
force excel to close when the report is complete

thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Force Excel to close

Do you have more than one workbook Opened?

"Nigel" wrote:

I have this at the end of the code

ThisWorkbook.Save
application.Quit

the workbook is saving but excel is not closing,

if I do this

thisworkbook.save
thisworkbook.close

and then on the before close event

application.quit

it seems to work fine

"JLGWhiz" wrote:

Application.Quit is the appropriate method of closing the application.
However, certain protocol should be followed in using it. Be sure that all
files for that instance of the application are closed before before
executing the Quit command. To avoid error or run time messages, when
closing the files, establish their saved status. Either save them, use the
Saved = True or SaveChanges = False to avoid the messages. A review of the
VBA help file on these topics might provide additional assistance.


"Nigel" wrote in message
...
I am running some automated reports and using a batch file to run them in
sequence, one issue I am having is forcing each report to close after it
is
complete, the command I am using is

application.quit but this seems to be very flaky, is there a better way to
force excel to close when the report is complete

thanks




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Force Excel to close

No its just the one, abatch file call each spreadsheet in turn

"Joel" wrote:

Do you have more than one workbook Opened?

"Nigel" wrote:

I have this at the end of the code

ThisWorkbook.Save
application.Quit

the workbook is saving but excel is not closing,

if I do this

thisworkbook.save
thisworkbook.close

and then on the before close event

application.quit

it seems to work fine

"JLGWhiz" wrote:

Application.Quit is the appropriate method of closing the application.
However, certain protocol should be followed in using it. Be sure that all
files for that instance of the application are closed before before
executing the Quit command. To avoid error or run time messages, when
closing the files, establish their saved status. Either save them, use the
Saved = True or SaveChanges = False to avoid the messages. A review of the
VBA help file on these topics might provide additional assistance.


"Nigel" wrote in message
...
I am running some automated reports and using a batch file to run them in
sequence, one issue I am having is forcing each report to close after it
is
complete, the command I am using is

application.quit but this seems to be very flaky, is there a better way to
force excel to close when the report is complete

thanks





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Force Excel to close

Check you task maanger to make sure you don't have more than one workbook
opened. Is the batch file calling each batch file and there is a workbook
open event so the macro in each workbook atumatically runs.

The close will close the workbook and automatically stop the macro because
the macro is part of the workbook that was closed leaving the application
open. if you are saving the workbook then you don't want to close the
workbook becasue the excel application will be left open. Instead just
perform the quit which wil also close the workbook.

"Nigel" wrote:

No its just the one, abatch file call each spreadsheet in turn

"Joel" wrote:

Do you have more than one workbook Opened?

"Nigel" wrote:

I have this at the end of the code

ThisWorkbook.Save
application.Quit

the workbook is saving but excel is not closing,

if I do this

thisworkbook.save
thisworkbook.close

and then on the before close event

application.quit

it seems to work fine

"JLGWhiz" wrote:

Application.Quit is the appropriate method of closing the application.
However, certain protocol should be followed in using it. Be sure that all
files for that instance of the application are closed before before
executing the Quit command. To avoid error or run time messages, when
closing the files, establish their saved status. Either save them, use the
Saved = True or SaveChanges = False to avoid the messages. A review of the
VBA help file on these topics might provide additional assistance.


"Nigel" wrote in message
...
I am running some automated reports and using a batch file to run them in
sequence, one issue I am having is forcing each report to close after it
is
complete, the command I am using is

application.quit but this seems to be very flaky, is there a better way to
force excel to close when the report is complete

thanks



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Force Excel to close

"flaky" ?
maybe add
Application.DisplayAlerts = False
before this line?

"Nigel" wrote in message
...
I am running some automated reports and using a batch file to run them in
sequence, one issue I am having is forcing each report to close after it
is
complete, the command I am using is

application.quit but this seems to be very flaky, is there a better way to
force excel to close when the report is complete

thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to force Excel wkbk to close JoAnn Excel Programming 2 September 29th 08 06:24 PM
How to force close the worksheet without having Excel prompt? Jack Excel Programming 6 July 9th 08 11:22 PM
How do you force excel to save on close Tom Hewitt Excel Discussion (Misc queries) 3 September 21st 06 10:55 AM
Is there a way to force Excel to close workbooks independently? Cam Excel Discussion (Misc queries) 4 February 2nd 06 07:43 PM
Macro to force Excel to close after a given timeframe of inactivit bobm Excel Programming 2 August 12th 05 02:41 AM


All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"