Yellow Property

Microsoft Word Visual Basic

expression.Yellow

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

Example

This example creates a new shape, then retrieves the four CMYK values from an existing shape in the active document, and then sets the CMYK fill color of the new shape to the same CMYK values.

Sub ReturnAndSetCMYK()
    Dim lngCyan As Long
    Dim lngMagenta As Long
    Dim lngYellow As Long
    Dim lngBlack As Long
    Dim shpHeart As Shape
    Dim shpStar As Shape

    Set shpHeart = ActiveDocument.Shapes(1)
    Set shpStar = ActiveDocument.Shapes.AddShape _
        (Type:=msoShape5pointStar, Left:=200, _
        Top:=100, Width:=150, Height:=150)

    'Get current shapes CMYK colors
    With shpHeart.Fill.ForeColor
        lngCyan = .Cyan
        lngMagenta = .Magenta
        lngYellow = .Yellow
        lngBlack = .Black
    End With

    'Set new shape to current shapes CMYK colors
    shpStar.Fill.ForeColor.SetCMYK _
        Cyan:=lngCyan, Magenta:=lngMagenta, _
        Yellow:=lngYellow, Black:=lngBlack
End Sub