Excel automation: how to disconnect correctly?

J

Jack

Hello,
My app hooks up to Excel the following way:
Set moExcelApp = CreateObject("Excel.Application")
Set moExcelWS = moExcelApp.ActiveWorkbook.ActiveSheet
and disconnects from it this way:
Set moExcelWS = Nothing
Set moExcelApp = Nothing

When should I use:
moExcelApp.Application.Quit
?
Under what circuimstances?
Is it really necessary to use it?

Your help appreciated,
Jack
 
P

Peter T

When should I use:
moExcelApp.Application.Quit

When you want to quit 'your' instance, irrespective as to whether user has
opened their own wb in your moExcelApp or some other reference refers to the
instance. In either case simply 'Set moExcelApp = Nothing' would not close
the app.

I responded to a similar question of yours the other day, not sure if you
saw it.

Regards,
Peter T
 

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