bgColor 属性

       

返回或设置代表当前网页背景色的 Variant 类型的值。可读写。

expression.bgColor

expression  必选。返回 DispFPHTMLDocument 对象的表达式。

示例

下列示例创建对活动网页窗口中的当前文档的引用,修改其背景色并显示该文档的标题。此时该网页的背景将呈现为黑色。

Sub DocumentbgColor()
'Returns the active HTML document and changes color

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objPgeWdw As PageWindowEx
    Set objApp = FrontPage.Application
    'Create reference to active page window.
    Set objPgeWdw = objApp.ActivePageWindow
    'Create reference to open document.
    Set objDoc = objPgeWdw.Document

    With objDoc
        'Display title and change background color
        MsgBox "The background color has changed for: " & .Title
        .bgColor = "000000"
    End With
End Sub