Opening .xls file in Excel from C#
-
Hi all, I'm trying to open an existing Excel file using Excel, from my C# application. I've managed doing so using the following code:
Excel.Application excelApp = new Excel.Application(); Excel.Workbook workBook = excelApp.Workbooks.Open(strFileName, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); excelApp.Visible = true;
However, I'm facing the following problem: Opening the file using this code creates a new process - EXCEL.exe, which doesn't ends after closing the Excel application! What am I doing wrong? Thanks a lot, Eyal. -
Hi all, I'm trying to open an existing Excel file using Excel, from my C# application. I've managed doing so using the following code:
Excel.Application excelApp = new Excel.Application(); Excel.Workbook workBook = excelApp.Workbooks.Open(strFileName, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); excelApp.Visible = true;
However, I'm facing the following problem: Opening the file using this code creates a new process - EXCEL.exe, which doesn't ends after closing the Excel application! What am I doing wrong? Thanks a lot, Eyal.eyalbi007, Some of the links in google might have some interesting info that might help. http://www.google.co.uk/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&hs=pjC&q=Excel.Application+close&btnG=Search&meta=[^]
Regards, Gareth. (FKA gareth111)
-
Hi all, I'm trying to open an existing Excel file using Excel, from my C# application. I've managed doing so using the following code:
Excel.Application excelApp = new Excel.Application(); Excel.Workbook workBook = excelApp.Workbooks.Open(strFileName, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); excelApp.Visible = true;
However, I'm facing the following problem: Opening the file using this code creates a new process - EXCEL.exe, which doesn't ends after closing the Excel application! What am I doing wrong? Thanks a lot, Eyal. -
Hi all, I'm trying to open an existing Excel file using Excel, from my C# application. I've managed doing so using the following code:
Excel.Application excelApp = new Excel.Application(); Excel.Workbook workBook = excelApp.Workbooks.Open(strFileName, 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); excelApp.Visible = true;
However, I'm facing the following problem: Opening the file using this code creates a new process - EXCEL.exe, which doesn't ends after closing the Excel application! What am I doing wrong? Thanks a lot, Eyal.have you made sure that you release all of your COM objects (like
excelApp
) when you're finished with them?Marshal.ReleaseComObject(...)
: http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.releasecomobject(VS.80).aspx[^]