HeaderBackColor Property

Microsoft Office Web Components Visual Basic

expression.HeaderBackColor

expression    Required. An expression that returns a PivotView object.

Remarks

When you set this property, you can use either a Long value representing a red-green-blue color value or a String value naming a valid HTML color value. For example, to set the object color to red, you could use the hexadecimal value &HFF, the decimal value 255, or the string value "red." In Microsoft Visual Basic, you can use the RGB function to create a red-green-blue color value (red is RGB(255,0,0)).

Use the HeaderFont, HeaderForeColor, and HeaderHAlignment properties in addition to this property to format the heading in the data area or an item in the filter area of a PivotTable list.

Example

This example formats the header for the data area and the filter area of the current view in PivotTable1.

Sub SetHeaderProperties()

    Dim ptView
    Dim ptConstants

    Set ptConstants = PivotTable1.Constants

    ' Set a variable to the current PivotTable view.
    Set ptView = PivotTable1.ActiveView

    ' Set the background color.
    ptView.HeaderBackColor = "Gray"

    ' Set the foreground color.
    ptView.HeaderForeColor = "Blue"

    ' Set the font.
    ptView.HeaderFont = "Tahoma"

    ' Set the alignment.
    ptView.HeaderHAlignment = ptConstants.plHAlignLeft

End Sub