View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Elsa Elsa is offline
external usenet poster
 
Posts: 8
Default Interop - "Unable to set the Color property of the Interior class"

Hello! I am begging for your help...

I am using the Excel interop (Microsoft Excel 11.0 Object Library, version
1.5.0.0) to open an existing workbook and adding conditional formats to
certain cells to mimic "hidding" them. I keep receiving exceptions from the
"Microsoft Office Excel" interop to the effect that I cannot set the font's
color and the interior's color. If you know, could you please reply to this
posting?

Thanks!

The C# code is as follows:

conditionalFormat =
conditionalFormats.Add(Excel.XlFormatConditionType .xlExpression
, System.Reflection.Missing.Value ,
(object)formulas.ToString(), System.Reflection.Missing.Value);
conditionalFormat.Font.Color = 0xff00; // triggers the
"Unable to set the Color property of the Font class"
conditionalFormat.Interior.Color = 0xff00; // triggers
the "Unable to set the Color property of the Interior class"
// conditionalFormat.Font.ColorIndex = 19; Triggers the
"Unable to set the ColorIndex property of the Font class"
// conditionalFormat.Interior.ColorIndex = 19; Triggers
the "Unable to set the ColorIndex property of the Interior class"