ColorFormat.RGB property (Word)

Returns or sets the red-green-blue (RGB) value of the specified color. Read/write Long.

Syntax

expression. RGB

expression A variable that represents a 'ColorFormat' object.

Example

This example sets the color of the second shape in the active document to gray.

ActiveDocument.Shapes(2).Fill.ForeColor.RGB = RGB(128, 128, 128)

This example sets the color of the shadow for Rectangle 1 in the active document to blue.

ActiveDocument.Shapes("Rectangle 1").Shadow.ForeColor.RGB = _ 
 RGB(0, 0, 255)

This example returns the value of the foreground color of the first shape in the active document.

MsgBox ActiveDocument.Shapes(1).Fill.ForeColor.RGB

See also

ColorFormat Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.