Return a Long whole number representing an RGB colour value.
Syntax RGB (red,green,blue) Key red Red component Variant(integer) 0-255 green Green component Variant(integer) 0-255 blue Blue component Variant(integer) 0-255
Convert a hex-format colour to RGB Long:
Function HexToLongRGB(strHexVal As String) As Long Dim intRed As Integer Dim intGreen As Integer Dim intBlue As Integer intRed = CLng("&H" & Left$(strHexVal, 2)) intGreen = CLng("&H" & Mid$(strHexVal, 3, 2)) intBlue = CLng("&H" & Right$(strHexVal, 2)) HexToLongRGB = RGB(intRed, intGreen, intBlue) End Function
The RGB() function can be used to create variables representing all the standard named CSS colours.
“You take the blue pill - the story ends, you wake up in your bed and believe whatever you want to believe. You take the red pill - you stay in Wonderland and I show you how deep the rabbit-hole goes” ~ The Matrix
Related:
Syntax - color - Convert RGB to Microsoft Access colour codes.
Average (mix) colours