M
Mo
I have tryed all the various versions of closing an excel object, but it
still remains in the Task Manager.
CODE SAMPLE ONE: =====================================
xlBook.SaveAs(getFile, Excel.XlFileFormat.xlWorkbookNormal, null, null,
true, false, Excel.XlSaveAsAccessMode.xlShared, false, false, null, null,
null);
xlBook.Close(null, null, null);
xlApp.Workbooks.Close();
xlApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBook);
xlSheet = null;
xlBook = null;
xlApp = null;
GC.Collect(); // force final cleanup!
CODE SAMPLE TWO: =====================================
xlBook.Close(true, GLName, null);
xlApp.Workbooks.Close();
GC.Collect(); // force final cleanup!
GC.WaitForPendingFinalizers();
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlRng);
xlRng = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet);
xlSheet = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBook);
xlBook = null;
xlApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp);
xlApp = null;
==================================================
I really hoped that this was fixed by now, I 've been fighting with this
since VB6... Any suggestion?
still remains in the Task Manager.
CODE SAMPLE ONE: =====================================
xlBook.SaveAs(getFile, Excel.XlFileFormat.xlWorkbookNormal, null, null,
true, false, Excel.XlSaveAsAccessMode.xlShared, false, false, null, null,
null);
xlBook.Close(null, null, null);
xlApp.Workbooks.Close();
xlApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBook);
xlSheet = null;
xlBook = null;
xlApp = null;
GC.Collect(); // force final cleanup!
CODE SAMPLE TWO: =====================================
xlBook.Close(true, GLName, null);
xlApp.Workbooks.Close();
GC.Collect(); // force final cleanup!
GC.WaitForPendingFinalizers();
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlRng);
xlRng = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet);
xlSheet = null;
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBook);
xlBook = null;
xlApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp);
xlApp = null;
==================================================
I really hoped that this was fixed by now, I 've been fighting with this
since VB6... Any suggestion?