Excel.exe remains in the Task Manager
-
Hi ppl, I am working on a project where excel sheet has to be generated. In the end i have added this piece of code. theWorkbook.SaveAs(SourceFile, Type.Missing, "", "", false, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); ExcelObj.Quit(); Marshal.ReleaseComObject(ExcelObj); theWorkbook = null; ExcelObj = null; but somehow its not removing the excel frm TM. and when i try to generate Excel again it gives error "Its already used by some program" --Naina
Still Debugging the past?..I have already coded the future..
-
Hi ppl, I am working on a project where excel sheet has to be generated. In the end i have added this piece of code. theWorkbook.SaveAs(SourceFile, Type.Missing, "", "", false, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); ExcelObj.Quit(); Marshal.ReleaseComObject(ExcelObj); theWorkbook = null; ExcelObj = null; but somehow its not removing the excel frm TM. and when i try to generate Excel again it gives error "Its already used by some program" --Naina
Still Debugging the past?..I have already coded the future..
-
You will have to release all the sheets, work books and then the excel objet. Here is a article onthat hope this helps. http://www.codeproject.com/KB/office/ReleaseExcelObject.aspx[^]
Thanks Laddie Kindly rate if the answer was helpful
No.. I did not get the clue how to solve this problem.... --Naina
Still Debugging the past?..I have already coded the future..
-
No.. I did not get the clue how to solve this problem.... --Naina
Still Debugging the past?..I have already coded the future..
You are trying to release only the excel object. Whcih actually houses the workbook object which again houses the sheet objects. Just by releasing the excel object the other object may not be releases and the excel object remains in the memory. If you can have a look in this article by antony100 (http://www.codeproject.com/KB/office/ReleaseExcelObject.aspx) He is calling the Marshal.ReleaseComObject(Reference); against workbooks then against the excel object. You will need to do the same to get the excel disposed from the mem.
Thanks Laddie Kindly rate if the answer was helpful