4pPor‖RGB Function [VBA]

Contents
XT9pD‖

# mBeiz‖RGB Function [VBA]

ZMjZi‖Returns a Long integer color value consisting of red, green, and blue components, according to VBA color formula.

R9TFi‖This constant, function or object is enabled with the statement Option VBASupport 1 placed before the executable program code in a module.

### FVEx2‖Syntax:

    RGB (Red, Green, Blue)

### bBBqF‖Return type:

Long

### WADQ4‖Parameters:

JVhSY‖ red: Any integer expression that represents the red component (0-255) of the composite color.

MeGD7‖ green: Any integer expression that represents the green component (0-255) of the composite color.

iP9Sd‖ blue: Any integer expression that represents the blue component (0-255) of the composite color.

2XAYm‖Because of the VBA compatibility mode (Option VBASupport 1), the Long value is calculated as
Result = red + green×256 + blue×65536.

### SEjHR‖Error codes:

5 Invalid procedure call

### EFSA4‖Example:

    Option VBASupport 1
    Sub ExampleRGBVBA
    Dim lVar As Long
        lVar = rgb(128,0,200)
    3KBtx‖    Print lVar; ' returns 13107328
    End Sub

Please support us!