Groups | Blog | Home
all groups > dotnet interop > december 2005 >

dotnet interop : Excel object not getting killed



Mr.Doubt
12/21/2005 1:34:15 AM
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...
Ken Tucker [MVP]
12/21/2005 6:33:48 AM
Hi,

Use marshal.releasecomobject

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

Ken
--------------------
[quoted text, click to view]

Herfried K. Wagner [MVP]
12/21/2005 12:36:57 PM
"Mr.Doubt" <dina.mrcool@gmail.com> schrieb:
[quoted text, click to view]

PRB: Office Application Does Not Quit After Automation from Visual Studio
..NET Client
<URL:http://support.microsoft.com/?scid=kb;EN-US;317109>
-> "Troubleshooting"

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
Yuri O
12/21/2005 9:30:33 PM
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


"Mr.Doubt" <dina.mrcool@gmail.com> ???????/???????? ? ???????? ?????????:
news:1135157654.982466.214220@g47g2000cwa.googlegroups.com...
[quoted text, click to view]

Michael D. Ober
12/30/2005 10:51:14 AM
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.

[quoted text, click to view]


AddThis Social Bookmark Button