I get the following exception when I try to access a FormatCondition item from a FormatConditions collection.
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.FormatCondition'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00024425-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
I'm using VS2010 SP1, C#, Excel 2010 32 bit
So far I created an excel spreadsheet and added Conditional Formatting to cell B3.
In code I:
- open the spreadsheet.
- get cell b3
- verify that FormatConditions.Count returns 1.
I get the above exception when I try the following:
fmtCond = (Excel.FormatCondition) testCell.FormatConditions.Item(1);
The code I'm using seems to work fine when build w/VS2005 and Excel 2007 on another PC.