ColorSchemes 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 all the ColorScheme objects in Microsoft Publisher. Each ColorScheme object represents a color scheme, which is a set of colors that are used in a publication.

Use the Count property to return the number of color schemes available to Publisher. The following example displays the number of color schemes.

Sub CountColorSchemes() 
 MsgBox Application.ColorSchemes.Count 
End Sub

Use the Item property to return a specific color scheme from the ColorSchemes collection. The Index argument of the Item property can be the number or name of the color scheme, or a PbColorScheme constant. The follow example sets the color scheme of the active publication to Wildflower.

Sub SetColorScheme() 
 ActiveDocument.ColorScheme _ 
 = ColorSchemes.Item(pbColorSchemeWildflower) 
End Sub

Use the Name property to return a color scheme name. The following example lists in a text box all the color schemes available to Publisher.

Sub ListColorShemes() 
 Dim clrScheme As ColorScheme 
 Dim strSchemes As String 
 For Each clrScheme In Application.ColorSchemes 
 strSchemes = strSchemes & clrScheme.Name & vbLf 
 ActiveDocument.Pages(1).Shapes.AddTextbox( _ 
 Orientation:=pbTextOrientationHorizontal, _ 
 Left:=72, Top:=72, Width:=400, Height:=500).TextFrame _ 
 .TextRange.Text = strSchemes 
End Sub