该属性设置或返回一个 Long 类型的数值,表示 CMYK 颜色中的黑色部分。只读。
expression.Black
expression 必需。该表达式返回“应用于”列表中的一个对象。
本示例新建一个图形,从活动文档的现有图形中获取四种 CMYK 颜色值,然后将新图形的 CMYK 填充颜色设置为相同的 CMYK 值。
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