I have a problem releasing Excel from Task Manager after I create an Excel file, Save and Close it from C#.
I use the following code to create the Excel instance:
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook workbook = xlApp.Workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets[1];
I then populate my worksheet:
worksheet.Cells[1, 1] = "Test";
worksheet.Cells[1, 2] = "Test";
worksheet.Cells[1, 3] = "Test";
worksheet.Cells[1, 4] = "Test";
After that I save the workbook:
workbook.SaveAs(filePath);
Then close it:
workbook.Close(false, false);
and then quit Excel:
xlApp.Quit();
But after I do this Excel still appears in the Task Manager!!?!?
Any idea why this doesn't get closed after I call xlApp.Quit()?
Thanks in advance.