CMYK Property

Microsoft Publisher Visual Basic

expression.CMYK

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

Example

This example creates two new shapes and then sets the CMYK fill color for one shape and sets the CMYK values of the second 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.Pages(1).Shapes.AddShape _
        (Type:=msoShapeHeart, Left:=100, _
        Top:=100, Width:=100, Height:=100)
    Set shpStar = ActiveDocument.Pages(1).Shapes.AddShape _
        (Type:=msoShape5pointStar, Left:=200, _
        Top:=100, Width:=150, Height:=150)

    With shpHeart.Fill.ForeColor.CMYK
       .SetCMYK 10, 80, 200, 30
        lngCyan = .Cyan
        lngMagenta = .Magenta
        lngYellow = .Yellow
        lngBlack = .Black
    End With

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