tags:

views:

770

answers:

1

I have a c# application that opens up a COM instance of excel and dumps some data from an Access 2000 database via oleDB onto the sheet then releases the excel object, but I get a window after I close the program with the title bar:

DDE Server Error: [applicationName.exe] - Application Error

I think I've narrowed this down to be an issue with closing excel before I close my program. Figuring this was an issue with the com objects I created, I went through my code and tried to find every place where I stored an Excel COM object and make sure it was released before setting it to null. I ignored ones I didn't store e.g.

excelSheet.GetRange("A1", "A1).Value2 = "Hello";

I still recieve the error and I think I've released all my stored COM objects, is there another reason I might still be getting this error?

A: 

Perhaps you're not properly cleaning up your Excel references?

Check out this thread on how to do this.

Jay Riggs
Thanks - I believe this is the answer I was looking for...Though the thought of creating a named object for each reference is terriffying... it's a big project. Wish I would have seen that info before! Hehe
Fry
You actually do not need a named object for every reference -- and trying to code in this style can get overwhelming fast, especially for a large project. Read the 2nd reply in that thread for an alternative approach, which I use all the time and find it to be vastly easier to use.
Mike Rosenblum