in reply to MS Excel 2007 never dies - or at least the process wont
First of all, it puzzles me greatly why you are ordering Excel to Quit(), and then waiting 5 seconds (I suppose) for it to have time to do so. Once Excel has been started, knowing this to be an expensive process, you want it to stay active for the duration.
But, “OLE knows how to do that already.” The OLE subsystem, not your requesting process, is the party that should be made solely responsible for starting the service process (Excel, in this case), and for ending it. This is done in part, I think, because of clients that otherwise would, as your program does, constantly ask the hosting program to quit.
I don’t see any evidence that you actually defined a Quit() destructor ... and this, technically, is probably the reason why it isn’t quitting ... but my point is that you don’t want it to quit every time, as you are now praying for it to do.
By far the easiest way to approach OLE is at the document level, not the application level. (It is my crystalline opinion that this is what the architects had in mind.) Unless you specifically need to control the visibility of the app to the user, you want to be talking to Excel.Spreadsheet, or what-have-you, not the Excel.Application that, you happen to know, is what drives “spreadsheets.” Ask for what you want to manipulate, and address your supplications to those things, not the application itself. OLE can, and will, determine and launch and manage those application instances on your behalf, and it will do so much more efficiently than you are, in the present case, attempting to do.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: MS Excel 2007 never dies - or at least the process wont
by Anonymous Monk on Aug 25, 2011 at 15:42 UTC | |
by davies (Monsignor) on Aug 25, 2011 at 16:03 UTC | |
by otism (Initiate) on Aug 25, 2011 at 16:40 UTC | |
by davies (Monsignor) on Aug 25, 2011 at 18:28 UTC | |
by otism (Initiate) on Aug 25, 2011 at 22:24 UTC | |
by otism (Initiate) on Aug 25, 2011 at 16:10 UTC |