ColorsInUse Object (Publisher)

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

A collection of ColorFormat objects that represent the colors present in the specified publication.

The ColorsInUse collection supports all the publication color models: RGB, process colors, and spot color.

For process color and spot color publications, colors are based on inks. For a given ink, a publication may contain several colors that are different tints or shades of that ink. Use the Plates collection to access the plates that represent the inks defined for a publication.

Use the ColorsInUse property of the Document object to return the ColorsInUse collection.

The following example lists properties of each color in the active publication that is based on the specified ink. This example assumes the publication's color mode has been defined as spot color or process and spot color.

Sub ListColorsBasedOnInk() 
Dim cfLoop As ColorFormat 
For Each cfLoop In ActiveDocument.ColorsInUse 
 With cfLoop 
 If .Ink = "2" Then 
 Debug.Print "BaseRGB: " & .BaseRGB 
 Debug.Print "RGB: " & .RGB 
 Debug.Print "TintShade: " & .TintAndShade 
 Debug.Print "Type: " & .Type 
 End If 
 End With 
Next cfLoop 
End Sub

Use ColorsInUse(index), where index is the color index number, to return a single ColorFormat object. The following example returns properties for the second color in the publication.

Sub ColorProperties() 
 With ActiveDocument.ColorsInUse(2) 
 Debug.Print "Color RBG: " & .RGB 
 Debug.Print "Ink RBG: " & .BaseRGB 
 Debug.Print "Tint: " & .TintAndShade 
 End With 
End Sub