ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   ColorConstants (https://www.excelbanter.com/excel-discussion-misc-queries/48526-colorconstants.html)

Bill Martin

ColorConstants
 
Searching through the Excel97 VBA Help system for something else, I came across
the entry for ColorConstants. It says:

The ColorConstants module contains predefined color constants.
These constants can be used anywhere in your code.

This sounds useful to me, but where in heck does one find the "ColorConstants
module"? It doesn't seem to automatically appear anywhere and doing a search of
my entire disk for some file of that name returns nothing. Also searching the
Microsoft website for "Colorconstants" returns nothing.

I have stumbled into the fact that I can use ColorConstants.vbMagenta for
example to set a color, but the drop down list only shows 8 "vb" colors.

Bill

Juan Pablo González

My understanding is that this enumeration is different than the 56 color
palette that Excel uses. Their RGB representation ends up being the same
(for the 8 colors that are available as a constant), but it's not the same
thing.

I guess another reason is that you can customize the color palette in Excel,
so that ColorIndex 1 is now something completely different than the
"standard" one. Then, any "builtin" constant that said that ColorIndex 1
was, say, red, would be wrong.

--
Regards,

Juan Pablo González
Excel MVP

"Bill Martin" wrote in message
...
Searching through the Excel97 VBA Help system for something else, I came
across the entry for ColorConstants. It says:

The ColorConstants module contains predefined color constants.
These constants can be used anywhere in your code.

This sounds useful to me, but where in heck does one find the
"ColorConstants module"? It doesn't seem to automatically appear anywhere
and doing a search of my entire disk for some file of that name returns
nothing. Also searching the Microsoft website for "Colorconstants"
returns nothing.

I have stumbled into the fact that I can use ColorConstants.vbMagenta for
example to set a color, but the drop down list only shows 8 "vb" colors.

Bill




George Nicholson

There is also a set of constants for the settings governed by the windows
color pallete: i.e., a constant that translates to the "window caption bar
backcolor/forecolor", "disabled control backcolor/Forecolor", " tooltips
backcolor/forecolor", etc. The idea being that you could use the "Disabled
textbox backcolor" constant in code/property settings and you will get
whatever color the user's window palette calls for: grey, red, etc.

I have a hardcopy of this list somewhere (circa 97, several dozen items) but
when I've tried to find it again on MSKB, I never could....

Not much help, I know...
--
George Nicholson

Remove 'Junk' from return address.


"Juan Pablo González" wrote in message
...
My understanding is that this enumeration is different than the 56 color
palette that Excel uses. Their RGB representation ends up being the same
(for the 8 colors that are available as a constant), but it's not the same
thing.

I guess another reason is that you can customize the color palette in
Excel, so that ColorIndex 1 is now something completely different than the
"standard" one. Then, any "builtin" constant that said that ColorIndex 1
was, say, red, would be wrong.

--
Regards,

Juan Pablo González
Excel MVP

"Bill Martin" wrote in message
...
Searching through the Excel97 VBA Help system for something else, I came
across the entry for ColorConstants. It says:

The ColorConstants module contains predefined color constants.
These constants can be used anywhere in your code.

This sounds useful to me, but where in heck does one find the
"ColorConstants module"? It doesn't seem to automatically appear
anywhere and doing a search of my entire disk for some file of that name
returns nothing. Also searching the Microsoft website for
"Colorconstants" returns nothing.

I have stumbled into the fact that I can use ColorConstants.vbMagenta for
example to set a color, but the drop down list only shows 8 "vb" colors.

Bill






Bill Martin

George Nicholson wrote:
There is also a set of constants for the settings governed by the windows
color pallete: i.e., a constant that translates to the "window caption bar
backcolor/forecolor", "disabled control backcolor/Forecolor", " tooltips
backcolor/forecolor", etc. The idea being that you could use the "Disabled
textbox backcolor" constant in code/property settings and you will get
whatever color the user's window palette calls for: grey, red, etc.

I have a hardcopy of this list somewhere (circa 97, several dozen items) but
when I've tried to find it again on MSKB, I never could....

Not much help, I know...


--------------------------------

What I started out looking for was some kind of listing of colors translated
into either the R,G,B values or into the LONG equivalent VBA uses:

ColorValue = RGB(r,g,b)

I would have thought that dead easy to find somewhere, but I haven't had much
luck searching the web thus far.

Bill


All times are GMT +1. The time now is 07:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com