Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns or sets a PbColorType constant that represents the red-green-blue (RGB) value of the specified color. Read/write.
Syntax
expression.RGB
expression A variable that represents a ColorFormat object.
Return value
PbColorType
Example
This example creates a new shape on the first page of the active publication and sets the fill color to red.
Sub SetFill()
ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShape5pointStar, _
Left:=100, Top:=100, Width:=100, Height:=100).Fill.ForeColor _
.RGB = RGB(Red:=255, Green:=0, Blue:=0)
End Sub
This example returns the value of the foreground color of the first shape on the first page of the active document. This example assumes that there is at least one shape on the first page of the active publication.
Sub ShowFillColor()
MsgBox "The RGB fill value of this shape is " & _
ActiveDocument.Pages(1).Shapes(1).Fill.ForeColor.RGB & "."
End Sub
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.