Share via


bgColor Property

Returns or sets a String, specifying a color name or red-green-blue (RGB) value, that represents the color behind the content for a specified object.

expression.bgColor

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

Remarks

The bgColor property is similar to the backgroundColor property; however, the bgColor property corresponds to the value of the bgcolor attribute, while the backgroundColor property corresponds to the backgroundcolor attribute for the STYLE element.

For more information about setting colors, see the HTML Color Table.

Example

The following example takes an FPHTMLDocument object and a string, and then sets the background color for the specified document if the background color is not already set.

Sub SetBackgroundColor(ByRef objDoc As FPHTMLDocument, ByRef strColor As String)
    If objDoc.bgColor = "NoColor" Then objdoc.bgColor = strColor
End Sub

Use the following example to call the preceding subroutine.

Sub CallSetBackgroundColor()
    Call SetBackgroundColor(objDoc:=ActiveDocument, strColor:="aqua")
End Sub

Applies to | FPHTMLBody Object | FPHTMLDocument Object | FPHTMLMarqueeElement Object | FPHTMLTable Object | FPHTMLTableCell Object | FPHTMLTableRow Object | FPHTMLTableSection Object | IHTMLBodyElement Object | IHTMLDocument2 Object | IHTMLMarqueeElement Object | IHTMLTable Object | IHTMLTableCell Object | IHTMLTableRow Object | IHTMLTableSection Object