Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Microsoft.Office.Interop.Excel.ApplicationClass' to interface type

383 views
Skip to first unread message

Ashish Sharma

unread,
Mar 7, 2008, 10:47:05 AM3/7/08
to
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

unread,
Jul 9, 2008, 11:33:01 PM7/9/08
to
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.
0 new messages