Colours
VBA.ColorConstants
The following is a list of the VBA.ColorConstants colour constants.
As different documents and worksheets have different colour palettes you must define the colours in term of the RGB(,,) function using the appropriate (long) integer.
The following table is a key of the most common colours used.
These constants can be used anywhere in your code
Colour | Constant | Red | Green | Blue | Value | Hex |
White | vbWhite | 255 | 255 | 255 | 16777215 | 0xFFFFFF |
Black | vbBlack | 0 | 0 | 0 | 0 | 0x0 |
Blue | vbBlue | 0 | 0 | 255 | 16711680 | 0xFF0000 |
Yellow | vbYellow | 255 | 255 | 153 | 10092543 | 0xFFFF |
Green | vbGreen | 153 | 255 | 153 | 10092441 | 0xFF00 |
Red | vbRed | 0xFF | ||||
Magenta | vbMagenta | 0xFF00FF | ||||
Cyan | vbCyan | 0xFFFF00 |
Dark Blue | ||||||
Light Blue | ||||||
Light Gray | ||||||
Dark Gray | ||||||
Light Red |
Converting Hex to Long
sHex = "AO"
Value - CLng("&H" & sHex)
Numbers in Hex &HFFFFFFF - is a number in HexADecimal
How do you convert between the types Hex(), Oct() and Bin() ??
Colour Constants
The following is a list of the VBA.SystemColorConstants colour constants.
vb3DDKShadow | 0x80000015 | darkest shadow colour for 3D display elements |
vb3DHighlight | 0x80000014 | highlight colour for 3D display elements |
vb3DLight | 0x80000016 | Second lightest 3D colour after vb3DHighlight |
vbActiveBorder | 0x8000000A | border colour of active window |
vbApplicationWorkspace | 0x8000000C | background colour of multiple document interface |
vbArchiveTitleBar | 0x80000002 | colour of the title bar for the active window |
vbButtonFace | 0x8000000F | colour of shading on the face of command buttons |
vbButtonShadow | 0x80000010 | colour of shading on the edge of command buttons |
vbButtonText | 0x80000012 | text colour on command buttons |
vbDesktop | 0x80000001 | desktop colour |
vbGrayText | 0x80000011 | Grayed disabled text |
vbHighlight | 0x8000000D | background colour of items selected in a control |
vbHighlightText | 0x8000000E | text colour of items selected in a control |
vbInactiveBorder | 0x8000000B | border colour of inactive window |
vbInactiveCaptionText | 0x80000013 | colour of inactive text in an inactive caption |
vbInactiveTitleBar | 0x80000003 | colour of the title bar for the inactive window |
vbInfoBackground | 0x80000018 | background colour of tooltips |
vbInfoText | 0x80000017 | colour of text in tooltips |
vbMenuBar | 0x80000004 | menu background colour |
vbMenuText | 0x80000007 | colour of text on menus |
vbScrollBars | 0x80000000 | scroll bar colour |
vbTitleBarText | 0x80000009 | colour of text in caption, size box and scroll arrow |
vbWindowBackground | 0x80000005 | window backgroundcolour |
vbWindowFrame | 0x80000006 | window frame colour |
vbWindowText | 0x80000008 | colour of text in windows |
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext