Red Function

Returns the Red component of the specified composite color code.


Red (ColorNumber As Long)

Return value:



ColorNumber: Long integer expression that specifies any composite color code for which to return the Red component.


Under VBA compatibility mode (Option VBASupport 1), the function Red() is incompatible with VBA colors, when color from previous call to function RGB [VBA] is passed.

Error codes:

D'oh! You found a bug (text/sbasic/shared/00000003.xhp#err5 not found).


The color picker dialog details the red, green and blue components of a composite color code, as well as its hexadecimal expression. Changing the color of text and selecting Custom color displays the color picker dialog.


Sub ExampleColor
Dim lVar As Long
    lVar = rgb(128,0,200)
    MsgBox "The color " & lVar & " consists of:" & Chr(13) &_
        "red= " & red(lVar) & Chr(13)&_
        "green= " & green(lVar) & Chr(13)&_
        "blue= " & blue(lVar) & Chr(13) , 64,"colors"
End Sub

Please support us!