Closing Excel within itself

  • Thread starter Thread starter Bruno G.
  • Start date Start date
B

Bruno G.

Hello!

Is it possible to close Excel (not just the workbook) from within a
Workbook_Open event?

I would like to use a scheduling proram to open a workbook, run the code in
the Open event, and shutdown Excel.

Thanks!

Bruno G.
 
Sorry about that...

Was sortta quick posting that stupid question! Of course, the answer is
Application.Quit
I was looking for Exit...

Bruno G.
 
Here is one I use to close all workbooks. So, try
application.displalerts=false
activeworkbook.save
application.quit

Sub CLOSE_ALL()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In Workbooks
w.Save
Next
Application.Quit
End Sub
 
Hi Bruno,
Is it possible to close Excel (not just the workbook) from within a
Workbook_Open event?

Application.quit does the job.

You need to make sure all workbooks are saved or discarded first
though.

Workbooks("Book1.xls").Saved=True sets a workbook to saved state
(without saving).

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top