ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel automation: how to disconnect correctly? (https://www.excelbanter.com/excel-programming/400630-excel-automation-how-disconnect-correctly.html)

jack

Excel automation: how to disconnect correctly?
 
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



Peter T

Excel automation: how to disconnect correctly?
 
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

"Jack" <replyto@it wrote in message
...
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






All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com