Actually I’m writing a small application (WinForms + C#), where I’m reading the Excel file. After exiting from the application and went to the task manager I found that Excel.exe is still running. And as I run my application several times I found multiple instances of Excel.exe running in the task manager.
So can somebody tell me as what needs to be done to kill “Excel.exe” each time I exit from the application…
The code is somewhat like this:
ApplicationClass appClass = new ApplicationClass();
Workbook workBook = appClass.Workbooks.Open(path, 0, true, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
Worksheet workSheet = (Worksheet) workBook.ActiveSheet;
All under this namespace: Microsoft.Office.Interop.Excel; that is COM
How are you reading the Excel file? If you’re using COM, you need to call
Application.Quitwhen you’re finished.Edit: from the code in your comment –