I have some code that opens an xls workbook;
Excel.Workbooks workBooks; workBooks = excelApp.Workbooks; workbook = workBooks.Open(sourceFilePath + sourceFileName + ".xls");
Then I will get a worksheet;
worksheets = workbook.Worksheets; worksheet = worksheets.get_Item("Standard");
Then I save the file as csv;
worksheet.SaveAs(sourceFilePath + sourceFileName + ".csv", Excel.XlFileFormat.xlCSVWindows, Type.Missing, Type.Missing, false, false, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing);
Then I try to close the book;
Marshal.FinalReleaseComObject(worksheet); Marshal.FinalReleaseComObject(worksheets); workbook.Close(); Marshal.FinalReleaseComObject(workbook);
However, every time I get to the line workbook.Close (), the system stops.
If I do not SaveAs, then the workbook just closes.
How to close a book?
change
The Task Manager shows that Excel.exe is still running. Closing will result in an error in my code.
change 2
I already saw the link referenced by SO, and it did not solve the problem.