ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel and VB.Net (https://www.excelbanter.com/excel-programming/273219-excel-vbulletin-net.html)

Gary Gibbons

Excel and VB.Net
 
I want to use Excel Object in my .NET application, that
is COM object in .NET environment. Now, I can start Excel
as Excel.Application(), after referencing in Excel
library. In this case I have a total control of Excel
object, but it is almost impossible to close it. Classic
methods obExcel.Quit, and obExcel = Nothing would not
help. Namely, Excel apparently closes but in the Task
Manager it can be seen still running. This is
known 'memory leak' and although I've been searching for
solution for weeks, I could not find one that works. So
after few times opening and closing Excel in VB.NET code
there is a bunch of Excel object instances, clogging my
memory resources.

On the other hand I can also launch Excel with a
process, in which case I can properly close Excel so it
is gone out of memory, however I do not have control of
Workbooks, Worksheets, Excel functions etc.

Now I was wondering if somebody could possibly know if it
is possible (and how) to maybe launch Excel as a process
and then associate this instance of Excel with the
process, OR, create Excel.Application object and then
associate it with a process (somehow get processID). In
both cases I would have control over Excel object, and
would be able to kill it clean, and empty the memory.

Any help would be welcome.

thanks!


All times are GMT +1. The time now is 05:39 PM.

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