Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6579627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:55:19+00:00 2026-05-25T15:55:19+00:00

I am open and close an excel book fro mC# like this Microsoft.Office.Interop.Excel.Application oXL

  • 0

I am open and close an excel book fro mC# like this

Microsoft.Office.Interop.Excel.Application oXL = null;
Microsoft.Office.Interop.Excel.Workbook excelWorkbook  = null;

try
{

    excelWorkbook = oXL.Workbooks.Open(MyFile,
                0, false, 5, "", "", false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "",
                true, false, 0, true, false, false);

    .....
    ....
    ....

    excelWorkbook.Save();
    excelWorkbook.Close(Microsoft.Office.Interop.Excel.XlSaveAction.xlSaveChanges, Type.Missing, Type.Missing);
    oXL.Quit();
    excelWorkbook = null;
    oXL = null;

}
catch { }

But there is stil lan EXCEL.EXE process left running in the task list, why ?
how do I “kill” everything about excel when I am done ?
Is it not enough with “.Quit()” and put the reference to null ?

or is there some magic reference left in the C# heap somewhere that have not been
dereferenced ?

/Stefan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:55:20+00:00Added an answer on May 25, 2026 at 3:55 pm

    Try this..

    oXL.quit()
    

    // Note, oXL still points to excel

    System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL)
    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(oXL)
    oXL = Nothing
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

static void Main() { Application excelapp = new Application(); Workbook book = excelapp.Workbooks.Open(@C:\HWYFAB.xlsx, 0,
i have this code in javascript a= Excel.Workbooks.open(C:/work/ind12.xls).ActiveSheet.Cells.find(value); if(a == null) document.getElementById('dateValid').innerText = Date
Does anyone know how to simply open and close an Excel workbook? I don't
I have an Excel application which doesn't close. This my code xlApp = new
Is there a way to open/close (i.e. start-up/shut-down) a winform application via ASP.NET? I'm
I want this to open on mouse over then close again when the mouse
I am using this function to close existing form and open a new form.
this is my code: f = open('text/a.log', 'wb') f.write('hahaha') f.close() and it is not
Is there a way to see if an Excel Workbook, say DataSheet.xls, is open
I have this code in JavaScript a= Excel.Workbooks.open(C:/work/ind12.xls).ActiveSheet.Cells.find(value); alert(a); Excel.close(); Excel = new ActiveXObject(Excel.Application);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.