Excel object not getting killed

  • Thread starter Thread starter Mr.Doubt
  • Start date Start date
M

Mr.Doubt

I've a widows application, that makes use of an EXCEL COM object, to
run a few macros available in a EXCEL file. The object is created when
the app is started and is closed when the app is closed. The app also
has a OLEDB connection to the same file to fetch data from the file and
display it on a datagrid.

Now my trouble is that, when I release the COM object, it gets released
from smoothly, to say, but the process is still running and can be seen
in the task manager.

I tried running without the OLEDB connection and the obj got destroyed
cleanly. Any guesses as to whats causing this??? Also, can anyone
suggest me, if there are ways to connect and query the object???

Pls respond, as I'm stuck with this for almost a day...
 
Hi,

Use marshal.releasecomobject

oExcel.Quit()
Marshal.ReleaseComObject(oExcel)
GC.Collect()

Ken
 
Mr.Doubt said:
I've a widows application, that makes use of an EXCEL COM object, to
run a few macros available in a EXCEL file. The object is created when
the app is started and is closed when the app is closed. The app also
has a OLEDB connection to the same file to fetch data from the file and
display it on a datagrid.

Now my trouble is that, when I release the COM object, it gets released
from smoothly, to say, but the process is still running and can be seen
in the task manager.

PRB: Office Application Does Not Quit After Automation from Visual Studio
..NET Client
<URL:http://support.microsoft.com/?scid=kb;EN-US;317109>
-> "Troubleshooting"
 
It is normal situation. Being an automation server Excel stay in memory for
some time being (same with Word ect.) ... & then it will be released
automatically (< 1 minute). You shouldn't take care about this :)

- Yuri
 
Actually, unless you specifically issue the Quit method to your excel
object, excel will remain in memory until you reboot. Word is the same.

Mike Ober.
 

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

Back
Top