Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Excel.exe remains in the Task Manager

Excel.exe remains in the Task Manager

Scheduled Pinned Locked Moved C#
comhelpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SeeSharp 0
    wrote on last edited by
    #1

    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..

    L 1 Reply Last reply
    0
    • S SeeSharp 0

      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..

      L Offline
      L Offline
      Laddie
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • L Laddie

        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

        S Offline
        S Offline
        SeeSharp 0
        wrote on last edited by
        #3

        No.. I did not get the clue how to solve this problem.... --Naina

        Still Debugging the past?..I have already coded the future..

        L 1 Reply Last reply
        0
        • S SeeSharp 0

          No.. I did not get the clue how to solve this problem.... --Naina

          Still Debugging the past?..I have already coded the future..

          L Offline
          L Offline
          Laddie
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups