nice to share the code... but there is huge mistake in it:
// never use two dots, all COM objects must be referenced and released individually
and yet, you do:
//Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"C:\MyFile.xlsx");
while it should be: Excel.WorkbookS xlWorkbookS = xlApp.Workbooks Excel.Workbook xlWorkbook = xlWorkbookS.Open(@"C:\MyFile.xlsx");
and later in GC() you should have BOTH Marshal.ReleaseComObject(xlWorkbook); Marshal.ReleaseComObject(xlWorkbookS);
nice to share the code... but there is huge mistake in it:
// never use two dots, all COM objects must be referenced and released individually
and yet, you do:
//Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"C:\MyFile.xlsx");
while it should be:
Excel.WorkbookS xlWorkbookS = xlApp.Workbooks
Excel.Workbook xlWorkbook = xlWorkbookS.Open(@"C:\MyFile.xlsx");
and later in GC() you should have BOTH
Marshal.ReleaseComObject(xlWorkbook);
Marshal.ReleaseComObject(xlWorkbookS);