Funció RGB [VBA]

Retorna un valor cromàtic en forma d'enter Long (llarg) que consisteix de components roig, verd i blau, segons la fórmula de colors de VBA.

warning

Aquesta constant, funció o objecte s'activa mitjançant l'expressió Option VBASupport 1, col·locada abans del codi executable del programa en un mòdul.


Sintaxi:


RGB (Red, Green, Blue)

Valor de retorn:

Long

Paràmetres :

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

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

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

warning

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


Codis d'error

5 La crida al procediment no és vàlida

Exemple :


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

Ens cal la vostra ajuda!