PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Excel object not getting killed

Reply

Excel object not getting killed

 
Thread Tools Rate Thread
Old 21-12-2005, 09:34 AM   #1
Mr.Doubt
Guest
 
Posts: n/a
Default Excel object not getting killed


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...

  Reply With Quote
Old 21-12-2005, 11:33 AM   #2
Ken Tucker [MVP]
Guest
 
Posts: n/a
Default Re: Excel object not getting killed

Hi,

Use marshal.releasecomobject

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

Ken
--------------------
"Mr.Doubt" <dina.mrcool@gmail.com> wrote in message
news:1135157654.982466.214220@g47g2000cwa.googlegroups.com...
> 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...
>



  Reply With Quote
Old 21-12-2005, 11:36 AM   #3
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
Default Re: Excel object not getting killed

"Mr.Doubt" <dina.mrcool@gmail.com> schrieb:
> 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"

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
  Reply With Quote
Old 21-12-2005, 07:30 PM   #4
Yuri O
Guest
 
Posts: n/a
Default Re: Excel object not getting killed

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...
> 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...
>



  Reply With Quote
Old 30-12-2005, 05:51 PM   #5
Michael D. Ober
Guest
 
Posts: n/a
Default Re: Excel object not getting killed

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.

"Yuri O" <a@a.a> wrote in message
news:uMyEDUmBGHA.3408@TK2MSFTNGP12.phx.gbl...
> 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...
> > 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...
> >

>
>
>




  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off