K
kowshik
We are using Excel 11.0 library in one of my c# project. We instantiate the
excel objects in the c# code and creating excel file on the server side. The
code is working fine on the local machine but it is failing on the dev
machine with the following description. Both machines are having excel 2003
installed.
The QueryInterface for interface Excel._Application failed.
I am sending the the excel code to this mail which causes this problem. I am
confused why this problem occurs. Please reply me in details.
The code as follows:
Excel.Application exlApplication = null;
Excel.Workbooks exlWorkBooks = null;
Excel._Workbook exlWorkBook = null;
// Create the Excel application object
exlApplication = new Application();
exlWorkBooks = exlApplication.Workbooks;
exlWorkBook =
exlWorkBooks.Open(strXMLPath,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
exlWorkBook.SaveAs(strEXLPath,XlFileFormat.xlWorkbookNormal,Type.Missing,Type.Missing,Type.Missing,Type.Missing,XlSaveAsAccessMode.xlExclusive,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
exlWorkBook.Close(null,null,null);
exlApplication.Workbooks.Close();
exlApplication.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject (exlWorkBooks);
System.Runtime.InteropServices.Marshal.ReleaseComObject (exlWorkBook);
System.Runtime.InteropServices.Marshal.ReleaseComObject (exlApplication);
exlWorkBook = null;
exlApplication = null;
exlWorkBooks = null;
Waiting for your response....
Thanks & Regards
Kowshik.
excel objects in the c# code and creating excel file on the server side. The
code is working fine on the local machine but it is failing on the dev
machine with the following description. Both machines are having excel 2003
installed.
The QueryInterface for interface Excel._Application failed.
I am sending the the excel code to this mail which causes this problem. I am
confused why this problem occurs. Please reply me in details.
The code as follows:
Excel.Application exlApplication = null;
Excel.Workbooks exlWorkBooks = null;
Excel._Workbook exlWorkBook = null;
// Create the Excel application object
exlApplication = new Application();
exlWorkBooks = exlApplication.Workbooks;
exlWorkBook =
exlWorkBooks.Open(strXMLPath,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
exlWorkBook.SaveAs(strEXLPath,XlFileFormat.xlWorkbookNormal,Type.Missing,Type.Missing,Type.Missing,Type.Missing,XlSaveAsAccessMode.xlExclusive,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
exlWorkBook.Close(null,null,null);
exlApplication.Workbooks.Close();
exlApplication.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject (exlWorkBooks);
System.Runtime.InteropServices.Marshal.ReleaseComObject (exlWorkBook);
System.Runtime.InteropServices.Marshal.ReleaseComObject (exlApplication);
exlWorkBook = null;
exlApplication = null;
exlWorkBooks = null;
Waiting for your response....
Thanks & Regards
Kowshik.