View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_3_] Peter T[_3_] is offline
external usenet poster
 
Posts: 81
Default Problem in setting Cell Interior Color filling.

Hi Venkat,

You are trying to apply a colour that does not exist in
the current palette of 56. So, Excel calculates what it
thinks is the nearest "existing" colour and applies the
associated Colorindex.

In a Default palette the "nearest" colour to
RGB(164,224,224) is indeed RGB(153, 204, 255), namely
Colorindex 37.

If you specifically want "your" colour, first you need to
customize one of the palette colors, like this:

Activeworkbook.colors(X) = RGB(164,224,224)
where X is a number 1 to 56

If "maybe" your colour already exists in the palette,
follow this logic to avoid unnecessarily customizing:

SomeFormat = MyRGB
If SomeFormat < MyRGB then
custmize a colour (as above)
SomeFormat = MyRGB 'try again
EndIf

Customized colour(s) are saved with the workbook.

Regards,
Peter

-----Original Message-----
Hi,
I am calling Excel from my Application. The code was

developed in Borland
C++ and I am making OLE call to set properties to the

Excel.

When I say
Cell.OlePropertyGet("Interior").OlePropertySet

("Color", RGB(164,224,224));
it assigns some other color, the RGB value of the

assigned color is RGB(153,
204, 255).
I dont want the user of this application to change the

color form excel and
every thing should happen from my code only.

Any help is appreciated.

Thanks in advance.

With Regards
Venkat
.