PlotArea.Interior.Color ... all white

M

Markus Grein

Hello everyone ! :)

Maybe someone can help me with a problem :

I am trying to assign a custom color to the plot area of an Excel chart
programmatically. So, I define a long variable (cCol51&) and assign the RGB
values as usual :

I kept the variable on the watch list during debugging, and it shows a value
of 16577006 - so far, so good.
Then, I want to assign that color (light shade of violet) to the PlotArea
background of a chart, like this :

And what does it ? Nuthin ... it makes it all *white* ... have checked with
my oculist, but there's nothing wrong with my color sensation ...
Doing the same to a certain range of cells, however, *does* the job alright
(??).

I *used* to assign the color via a modified ColorIndex of 51 - that went
well, but I thought it might be better not mess around with the user's color
schemes.`
On the other side, setting the variable to RGB(255,0,0) works fine!

Any idea why the RGB / long variable method does not work with the custom
color I'd want to use here ?
Are there limitations to the color settings of a PlotArea as opposed to a
cell ?

Thanks a lot in advance !!

cheers,
Markus
 
M

Markus Grein

by the way ... that's Excel 2k under Win2k ...


Markus Grein said:
Hello everyone ! :)

Maybe someone can help me with a problem :

I am trying to assign a custom color to the plot area of an Excel chart
programmatically. So, I define a long variable (cCol51&) and assign the RGB
values as usual :


....
 
T

Tom Ogilvy

Just a guess. Colors are restricted to the 56 colors defined in the
palatte. If you assign an RGB color, it is mapped to the nearest color in
the palatte. If you go to Tools=>Options, color tab, you see there are only
8 colors listed for chart fill. Perhaps your color is being mapped to white
as the closest.
 
P

Peter T

Markus,

If you have a default palette Tom is most certainly right.
Your very pale lilac will be mapped to the nearest colour
which is white (colorindex 2). Instead try:

Activeworkbook.colors(15) = RGB(238, 241, 252)

Colorindex(15) is applied to the Plot area by default (not
same as "automatic"), light grey in an uncustomized
palette. Plot areas in new charts, as well as those to
which you have not applied another colour, will adopt your
customized colour. Of course you could customize any
other palette colour and apply that instead.

Cell and Chart colour formats can only accept palette or
automatic colours (system black & white).

The "Chart fill" colours Tom referred to are applied both
by default and as automatic colours to series that can be
filled. Linked to series / color index orders starting at
1 & 17 respectively, and not limited to 8.

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top