Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem Closing Excel
Found the solution...tried to close the objects in an excel event...how
should an object destroy it self from the inside...think i have to go to school again;-) have a nice day! "m.ahrens" wrote: Hi All I have problems Closing excel... Excel 2003 / Visual Studio 2003 / C# The Code I use: oExcel.WorkbookBeforeSave -= EventDel_BeforeBookSave; oExcel.WorkbookDeactivate -= EventDel_Deactivate; PIDHandler.NAR(wSheet); wBook.Close(false, Type.Missing, Type.Missing); PIDHandler.NAR(wBook); PIDHandler.NAR(wBooks); oExcel.Quit(); PIDHandler.NAR(oExcel); GC.Collect(); GC.WaitForPendingFinalizers(); static public void NAR(object o) { try { System.Runtime.InteropServices.Marshal.ReleaseComO bject(o); } catch { } finally { o = null; } } After Compleating the code above, Excel produces a total crash: "Microsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenience." You know, this error, where you can send a "Error Report" to microsoft. What might i be doing wrong? thanks for your help m.ahrens |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem when closing Excel 2007 and with Add-ins | Excel Discussion (Misc queries) | |||
Problem closing Excel | Excel Discussion (Misc queries) | |||
Problem closing Excel | Excel Programming | |||
Excel Closing Problem | Excel Programming | |||
Problem with closing the excel application | Excel Programming |