By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,573 Members | 1,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,573 IT Pros & Developers. It's quick & easy.

Close a running application

P: n/a
I have a program that updates an Excel sheet everytime
the user presses a button. However, each time it creates
a new instance of the Excel.exe application running in
the background.
I tried closing my Excel object (oExcel) using the
following:
oExcel = Nothing
oExcel.quit()

Yet, I still can see an instance of Excel.exe in the
Windows Task Manager Processes.

Any idea on how to force this application to terminate
once I'm done with it?

Note1: I define the Excel object using:

Dim oExcel As Excel.Application
oExcel = CType(CreateObject("Excel.Application"), _
Excel.Application)

Note2: When I end my program, that instance of Excel
disappears. I wish to see that without leaving my program.
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

Marshal.ReleaseComObject(oExcel)

Ken
-----------
"Amjad" <am*********@hotmail.com> wrote in message
news:04****************************@phx.gbl...
I have a program that updates an Excel sheet everytime
the user presses a button. However, each time it creates
a new instance of the Excel.exe application running in
the background.
I tried closing my Excel object (oExcel) using the
following:
oExcel = Nothing
oExcel.quit()

Yet, I still can see an instance of Excel.exe in the
Windows Task Manager Processes.

Any idea on how to force this application to terminate
once I'm done with it?

Note1: I define the Excel object using:

Dim oExcel As Excel.Application
oExcel = CType(CreateObject("Excel.Application"), _
Excel.Application)

Note2: When I end my program, that instance of Excel
disappears. I wish to see that without leaving my program.

Nov 20 '05 #2

P: n/a
* "Amjad" <am*********@hotmail.com> scripsit:
I have a program that updates an Excel sheet everytime
the user presses a button. However, each time it creates
a new instance of the Excel.exe application running in
the background.
I tried closing my Excel object (oExcel) using the
following:
oExcel = Nothing
oExcel.quit()

Yet, I still can see an instance of Excel.exe in the
Windows Task Manager Processes.

Any idea on how to force this application to terminate
once I'm done with it?

Note1: I define the Excel object using:

Dim oExcel As Excel.Application
oExcel = CType(CreateObject("Excel.Application"), _
Excel.Application)

Note2: When I end my program, that instance of Excel
disappears. I wish to see that without leaving my program.


\\\
System.Runtime.InteropServices.Marshal.ReleaseComO bject(App)
App = Nothing

' Perhaps you need these lines too:
GC.Collect()
GC.WaitForPendingFinalizers()
///

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

P: n/a
Hi..
Thanks for your reply, but the problem hasn't been solved
yet! (Excel.exe is still running in the background)
Any other suggestions?

Amjad
-----Original Message-----
* "Amjad" <am*********@hotmail.com> scripsit:
I have a program that updates an Excel sheet everytime
the user presses a button. However, each time it creates a new instance of the Excel.exe application running in
the background.
I tried closing my Excel object (oExcel) using the
following:
oExcel = Nothing
oExcel.quit()

Yet, I still can see an instance of Excel.exe in the
Windows Task Manager Processes.

Any idea on how to force this application to terminate
once I'm done with it?

Note1: I define the Excel object using:

Dim oExcel As Excel.Application
oExcel = CType(CreateObject("Excel.Application"), _
Excel.Application)

Note2: When I end my program, that instance of Excel
disappears. I wish to see that without leaving my
program.
\\\
System.Runtime.InteropServices.Marshal.ReleaseCom Object (App)App = Nothing

' Perhaps you need these lines too:
GC.Collect()
GC.WaitForPendingFinalizers()
///

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
.

Nov 20 '05 #4

P: n/a
Hi Amjad,

You may have to do the same sort of releasing on <all> of the Excel
objects that you create.

Next year's .NET will include better Office integration. Perhaps they will
have addressed this issue.

In the meantime, the interop newsgroup is possibly the best place for this
question as they must have been asked it a hundred times for Excel and all the
other Office products.
news://msnews.microsoft.com/microsof...mework.interop

Regards,
Fergus
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.