SetCMYK Method

Microsoft Word Visual Basic

expression.SetCMYK(Cyan, Magenta, Yellow, Black)

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

Cyan   Required Long. A number that represents the cyan component of the color. Can be any number from 0 to 255.

Magenta   Required Long. A number that represents the magenta component of the color. Can be any number from 0 to 255.

Yellow   Required Long. A number that represents the yellow component of the color. Can be any number from 0 to 255.

Black   Required Long. A number that represents the black component of the color. Can be any number from 0 to 255.

Example

This example adds a shape to the active document and sets the CMYK fill and line colors for the specified shape.

Sub SetCMYKColor()
    Dim shpHeart As Shape

    Set shpHeart = ActiveDocument.Shapes.AddShape _
        (Type:=msoShapeHeart, Left:=100, Top:=100, _
        Width:=100, Height:=100)
    With shpHeart
        .Fill.ForeColor.SetCMYK Cyan:=0, _
            Magenta:=255, Yellow:=100, Black:=0
        .Line.ForeColor.SetCMYK Cyan:=0, _
            Magenta:=255, Yellow:=100, Black:=20
    End With
End Sub