Discussion:
Microsoft.Office.Interop.Excel.ApplicationClass' to interface type
(too old to reply)
Ashish Sharma
2008-03-07 15:47:05 UTC
Permalink
Hi,

I created an application using C# in Visual Studio 2008. The application
gets all the data from the Microsoft Projects Planner (MPP) file and then
after some complex calculations save some figures to Excel file. I am using
Microsoft Interop Assemblies 11 for accessing the Projects and Excel.

The application works fine on Windows Vista. But it fails on Windows 2000
with the following error:


Unable to cast COM object of type
'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type
'Microsoft.Office.Interop.Excel._Application'. This operation failed because
the QueryInterface call on the COM component for the interface with IID
'{000208D5-0000-0000-C000-000000000046}' failed due to the following error:
No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)).


The softwares installed in my Windows Vista machine are as follows:

MS-Office 2007 (Excel, Projects Standard, Access, Outlook)



Windows 2000 Machine is equipped with the following:

MS-Office 2003 (Excel, Projects Standard, Access, Outlook)




The code for saving the values to the excel file is as follows:


using MSExcel = Microsoft.Office.Interop.Excel;


MSExcel._Application msExcel = new MSExcel.Application();
ProjectProgressChartOutputMapper projectProgressChartOutputMapper = new
ProjectProgressChartOutputMapper();


mppFolderName = mppFolderName + "graphplotingcoordinates.xls";


//------------------------------------
//Code fails at this line
//------------------------------------

MSExcel.Workbook msExcelWorkbook =
(MSExcel.Workbook)(((MSExcel._Application)msExcel).Workbooks.Open(mppFolderName,
Type.Missing, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing));




The same code works perfectly in WIndows Vista. Also I had taken the
references of Office Interop Assemblies 11 (Not 12.0)
--
Thanks
-Ashish Sharma
Karyn
2008-07-10 03:33:01 UTC
Permalink
How do i fix the same error message you have. I do not know how to enter a
code. Is there a link?
I am trying to get my database to export to excel and I get the same error
message listed. I have done this many times, but just got the message today.
Post by Ashish Sharma
Hi,
I created an application using C# in Visual Studio 2008. The application
gets all the data from the Microsoft Projects Planner (MPP) file and then
after some complex calculations save some figures to Excel file. I am using
Microsoft Interop Assemblies 11 for accessing the Projects and Excel.
The application works fine on Windows Vista. But it fails on Windows 2000
Unable to cast COM object of type
'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type
'Microsoft.Office.Interop.Excel._Application'. This operation failed because
the QueryInterface call on the COM component for the interface with IID
No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)).
MS-Office 2007 (Excel, Projects Standard, Access, Outlook)
MS-Office 2003 (Excel, Projects Standard, Access, Outlook)
using MSExcel = Microsoft.Office.Interop.Excel;
MSExcel._Application msExcel = new MSExcel.Application();
ProjectProgressChartOutputMapper projectProgressChartOutputMapper = new
ProjectProgressChartOutputMapper();
mppFolderName = mppFolderName + "graphplotingcoordinates.xls";
//------------------------------------
//Code fails at this line
//------------------------------------
MSExcel.Workbook msExcelWorkbook =
(MSExcel.Workbook)(((MSExcel._Application)msExcel).Workbooks.Open(mppFolderName,
Type.Missing, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing));
The same code works perfectly in WIndows Vista. Also I had taken the
references of Office Interop Assemblies 11 (Not 12.0)
--
Thanks
-Ashish Sharma
Loading...