Share via


ColorFormat.RGB Property

Word Developer Reference

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.

Visual Basic for Applications
  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.

Visual Basic for Applications
  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.

Visual Basic for Applications
  MsgBox ActiveDocument.Shapes(1).Fill.ForeColor.RGB

See Also