Discussion Locked

Closing Excel from command line

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a question on EXCEL 2000. I do a post backup command from my backup program(GRbackPro) to open an Excel file which runs a macro to append data and closes the file again. However , I cannot get Excel to close down. How can I do this , either from the macro or on the command line in the GRbackPro program. Thanks.

8 replies

by dklippert

If it's an Excel macro, the code would go something like:

For Each w in Application.Workbooks
w.Save
Next w
Application.Quit

If you don't want to save the workbook(s) use:
ApplicationDisplayAlerts = False

by hersheyboy

I already have a Workbook.Save line which does save the open workbook. I added an Application.Quit line but the Excel program remains open after the Workbook is saved and closed.

by dklippert

I don't know if this is your situation, but
you can't close the Workbook before you run Application.Quit.
Save the Workbook, then quit the app. don't close the workbook.

by hersheyboy

The last solution from DKlippert worked. Sometimes it is hard to understand the answer when the author assumes a particular piece of knowledge is understood by the peron asking the question. Thanks for your determination in following up your answers.150 points awarded.

This discussion is closed to new replies.