How do I terminate an Instance of Excel

R

rg

Where do I find VBA code that not only will detect an instance of Excel
running but will terminate it?

Thank you.

Roy
 
J

JP

See http://support.microsoft.com/kb/288902

Check out:

set xlApp = GetObject(, "Excel.Application")

If an instance of Microsoft Excel is running when this code is
executed, you have access to the running instance's object model
through the xlApp variable. If no instance is running, you receive the
following trappable run-time error message:

Run-time error '429':
ActiveX component can't create object


Then you can use xlApp.Quit to close it.

HTH,
JP
 

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

Top