ColorScheme object (Publisher)
Represents a color scheme, which is a set of eight colors used for the different elements of a publication. Each color is represented by a ColorFormat object.
The ColorScheme object is a member of the ColorSchemes collection. The ColorSchemes collection contains all the color schemes available to Microsoft Publisher.
Remarks
Use the ColorScheme property of the Document object to return the color scheme for the current publication.
Use the Name property to return a color scheme name.
Example
The following example sets the fill value of three shapes on the first page to the return value (in RGB format) of three of the eight ColorScheme colors.
Sub ReturnColorsAndApplyToShapes()
Dim lngAccent1 As Long
Dim lngAccent2 As Long
Dim lngAccent3 As Long
With ActiveDocument
With .ColorScheme
lngAccent1 = .Colors(pbSchemeColorAccent1).RGB
lngAccent2 = .Colors(pbSchemeColorAccent2).RGB
lngAccent3 = .Colors(pbSchemeColorAccent3).RGB
End With
With .Pages(1)
.Shapes(1).Fill.ForeColor.RGB = lngAccent1
.Shapes(2).Fill.ForeColor.RGB = lngAccent2
.Shapes(3).Fill.ForeColor.RGB = lngAccent3
End With
End With
End Sub
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
Next
ActiveDocument.Pages(1).Shapes.AddTextbox( _
Orientation:=pbTextOrientationHorizontal, _
Left:=72, Top:=72, Width:=400, Height:=500).TextFrame _
.TextRange.Text = strSchemes
End Sub
Properties
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.