I have inherited an App desigend by an ex employee
Sometimes the program leaves Excel in the task manager
The programe uses various routines and calling various functions that define
Excel sheets etc (badly named)
I'm finding it hard to follow (my 1st experince of .NET)
is there a way to KILL any Excel instence when exiting the program.
I have come across some posts about GC (garbage collection)
like this
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXLWsheet)
oXLWsheet = Nothing
'System.Runtime.InteropServices.Marshal.ReleaseComObject(oXLWs)
oXLWs = Nothing
oBook.Close()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBook)
oBook = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(oBooks)
oBooks = Nothing
oExcel.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel)
oExcel = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
-----
My problem is I don't know ALL the Sheets & Books etc that have been defined
/used
program loops about a lot
It would be nice just to do someting like
Loop Until NoMore
GetProcessByName("EXCEL")
Kill Process
END
Jim Rech - 27 Oct 2004 11:42 GMT
This might be more a .Net question and an Excel question. While someone
passing through here may have something to contribute, you also might want
to ask a .Net newsgroup.

Signature
Jim Rech
Excel MVP
|I have inherited an App desigend by an ex employee
|
[quoted text clipped - 35 lines]
| Kill Process
| END