BackColor Property

Microsoft Office Web Components Visual Basic

Returns or sets the background color for the specified object or area. When you set this property, you can use either a Long value representing a red-green-blue (RGB) color value or a String value representing 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 (for example, red is RGB(255,0,0)). Read/write Variant.

expression.BackColor

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

This property always returns the color as a Long value representing an RGB color value.

Example

This example sets the font size, foreground color, and background color for the title bar in PivotTable1 .

Sub Format_Titlebar()
    Dim vwView
    
    Set vwView = PivotTable1.ActiveView
    
    ' Set the background color of the title bar.
    vwView.Label.BackColor = "DarkSalmon"
    
    ' Set the font size of the title bar.
    vwView.Label.Font.Size = 16
    
    ' Set the foreground color of the title bar.
    vwView.Label.ForeColor = "Sienna"
End Sub