Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

VB.Net and the Excel 97 COM object

I have the honour of writing a VB.Net app that interfaces with the Excel 97 COM object.

Everything is fine, until I try to make the object go away. It won't. It just hangs around until the app is closed down.

A check of the Microsoft site (and others) says that this behaviour is due to the unmanaged COM object not being garbage collected the same as the managed objects. But, they really don't give a way in which to force the garbage collection. And yes, I am setting all of the references I get from Excel to Nothing, and calling App.Quit.

Any ideas?

I'm in the process of seeing if I can get a handle from the Excel COM object reference, because I do have an example that will kill a handle.

And, since you are probably going "Excel 97? who still uses that in production?", I'm just glad that I'm not having to try to get to Excel 95, which is where most of the production stuff is....

Saturday, January 15, 2005

Let me jusy say I am sorry you have a VB.NET app.

Saturday, January 15, 2005

Well, gee, I hope whatever I post will be at least as helpful as what that last guy wrote.

Googling on

"vb .net" "excel 97" (quit OR exit)

and reading and following a few links, I found something about the ReleaseComObject method:

Sunday, January 16, 2005


I did try various combinations at Microsoft and Google....

However, this method requires grabbing all of the intermediate object references into variables and then setting those variables to nothing after use.

Considering the massive amount of Excel object model interfacing that I am going through, and future maintenance by people who won't read the doco about this, I've concluded that this method isn't practible for implementation in our environment.

Tuesday, January 18, 2005

*  Recent Topics

*  Fog Creek Home