ColorSchemes Object

Publisher Developer Reference

A collection of all the ColorScheme objects in Microsoft Office Publisher. Each ColorScheme object represents a color scheme, which is a set of colors that are used in a publication.

Example

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

Visual Basic for Applications
  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.

Visual Basic for Applications
  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.

Visual Basic for Applications
  Sub ListColorShemes()
Dim clrScheme As ColorScheme
Dim strSchemes As String

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

End Sub

See Also