RGB Property

Microsoft Word Visual Basic

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

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