RGB Property

Microsoft Publisher Visual Basic

expression.RGB

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example creates a new shape to 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