Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default QueryInterface for interface Excel._Application failed.

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.Mis sing,Type.Missing,Type.Missing,Type.Missing,Type.M issing,Type.Missing,Type.Missing,Type.Missing,Type .Missing,Type.Missing,Type.Missing,Type.Missing,Ty pe.Missing);

exlWorkBook.SaveAs(strEXLPath,XlFileFormat.xlWorkb ookNormal,Type.Missing,Type.Missing,Type.Missing,T ype.Missing,XlSaveAsAccessMode.xlExclusive,Type.Mi ssing,Type.Missing,Type.Missing,Type.Missing,Type. Missing);


exlWorkBook.Close(null,null,null);
exlApplication.Workbooks.Close();

exlApplication.Quit();



System.Runtime.InteropServices.Marshal.ReleaseComO bject (exlWorkBooks);

System.Runtime.InteropServices.Marshal.ReleaseComO bject (exlWorkBook);

System.Runtime.InteropServices.Marshal.ReleaseComO bject (exlApplication);

exlWorkBook = null;
exlApplication = null;
exlWorkBooks = null;

Waiting for your response....

Thanks & Regards
Kowshik.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default QueryInterface for interface Excel._Application failed.

Kowshik
Try:
Excel.Application xlApp = new Excel.Application();
Excel.Workbook wb;
wb = xlApp.workbooks.open(.....);

wb.saveAs(...);

I dont think you need your exlworkbooks object

If this doesn't work i have working code that uses the ApplicationClass
instead of Application

cheers
Simon

"kowshik" wrote:

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.Mis sing,Type.Missing,Type.Missing,Type.Missing,

Type.Missing,Type.Missing,Type.Missing,Type.Missin g,Type.Missing,Type.Missing,Type.Missing,Type.Miss ing,Type.Missing);

exlWorkBook.SaveAs(strEXLPath,XlFileFormat.xlWorkb ookNormal,Type.Missing,Type.Missing,Type.Missing,

Type.Missing,XlSaveAsAccessMode.xlExclusive,Type.M issing,Type.Missing,Type.Missing,Type.Missing,Type .Missing);


exlWorkBook.Close(null,null,null);
exlApplication.Workbooks.Close();

exlApplication.Quit();



System.Runtime.InteropServices.Marshal.ReleaseComO bject (exlWorkBooks);

System.Runtime.InteropServices.Marshal.ReleaseComO bject (exlWorkBook);

System.Runtime.InteropServices.Marshal.ReleaseComO bject (exlApplication);

exlWorkBook = null;
exlApplication = null;
exlWorkBooks = null;

Waiting for your response....

Thanks & Regards
Kowshik.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default QueryInterface for interface Excel._Application failed.

Hi Simon Murphy:

Thanks for your sugestions.
Please send me the code which you are having that uses Application Class
instead of Application.

Waiting for your reply,
Thanks & Regards,
koushik

"Simon Murphy" wrote:

Kowshik
Try:
Excel.Application xlApp = new Excel.Application();
Excel.Workbook wb;
wb = xlApp.workbooks.open(.....);

wb.saveAs(...);

I dont think you need your exlworkbooks object

If this doesn't work i have working code that uses the ApplicationClass
instead of Application

cheers
Simon

"kowshik" wrote:

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.Mis sing,Type.Missing,Type.Missing,Type.Missing,

Type.Missing,Type.Missing,Type.Missing,Type.Missin g,Type.Missing,Type.Missing,Type.Missing,Type.Miss ing,Type.Missing);

exlWorkBook.SaveAs(strEXLPath,XlFileFormat.xlWorkb ookNormal,Type.Missing,Type.Missing,Type.Missing,

Type.Missing,XlSaveAsAccessMode.xlExclusive,Type.M issing,Type.Missing,Type.Missing,Type.Missing,Type .Missing);


exlWorkBook.Close(null,null,null);
exlApplication.Workbooks.Close();

exlApplication.Quit();



System.Runtime.InteropServices.Marshal.ReleaseComO bject (exlWorkBooks);

System.Runtime.InteropServices.Marshal.ReleaseComO bject (exlWorkBook);

System.Runtime.InteropServices.Marshal.ReleaseComO bject (exlApplication);

exlWorkBook = null;
exlApplication = null;
exlWorkBooks = null;

Waiting for your response....

Thanks & Regards
Kowshik.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method 'COMAddIns' of object '_Application' failed Samko Excel Programming 0 January 23rd 05 06:11 PM
QueryInterface for interface Excel._Application error koushik Excel Programming 0 December 24th 04 09:17 AM
1004 Method 'COMAddIns' of object '_Application' failed matt Excel Programming 0 December 15th 03 05:23 PM
1004 method 'COMAddIns' of object '_Application' failed matt Excel Programming 0 December 15th 03 02:32 PM
Method 'ActivePrinter' of object '_Application' failed kiat Excel Programming 0 August 18th 03 03:45 PM


All times are GMT +1. The time now is 02:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"