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

ColourConstantRedGreenBlueValueHex
WhitevbWhite255255255167772150xFFFFFF
BlackvbBlack00000x0
BluevbBlue00255167116800xFF0000
YellowvbYellow255255153100925430xFFFF
GreenvbGreen153255153100924410xFF00
RedvbRed    0xFF
MagentavbMagenta    0xFF00FF
CyanvbCyan    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.

vb3DDKShadow0x80000015darkest shadow colour for 3D display elements
vb3DHighlight0x80000014highlight colour for 3D display elements
vb3DLight0x80000016Second lightest 3D colour after vb3DHighlight
vbActiveBorder0x8000000Aborder colour of active window
vbApplicationWorkspace0x8000000Cbackground colour of multiple document interface
vbArchiveTitleBar0x80000002colour of the title bar for the active window
vbButtonFace0x8000000Fcolour of shading on the face of command buttons
vbButtonShadow0x80000010colour of shading on the edge of command buttons
vbButtonText0x80000012text colour on command buttons
vbDesktop0x80000001desktop colour
vbGrayText0x80000011Grayed disabled text
vbHighlight0x8000000Dbackground colour of items selected in a control
vbHighlightText0x8000000Etext colour of items selected in a control
vbInactiveBorder0x8000000Bborder colour of inactive window
vbInactiveCaptionText0x80000013colour of inactive text in an inactive caption
vbInactiveTitleBar0x80000003colour of the title bar for the inactive window
vbInfoBackground0x80000018background colour of tooltips
vbInfoText0x80000017colour of text in tooltips
vbMenuBar0x80000004menu background colour
vbMenuText0x80000007colour of text on menus
vbScrollBars0x80000000scroll bar colour
vbTitleBarText0x80000009colour of text in caption, size box and scroll arrow
vbWindowBackground0x80000005window backgroundcolour
vbWindowFrame0x80000006window frame colour
vbWindowText0x80000008colour of text in windows

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext