View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
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