This documentation is archived and is not being maintained.

FPHTMLBaseFontElement Object

Office 2003
Multiple objects

Represents the BASEFONT element in an HTML document. Using the FPHTMLBaseFontElement object, you can specify base font characteristics such as name, size, and color. See also the IHTMLBaseFontElement object.

Using the FPHTMLBaseFontElement object

Use the Item method to return an FPHTMLBaseFontElement object. The following example function takes an FPHTMLDocument object, one required String (representing the name of the font), and one optional String (representing the size of the font). The function then changes the base font's face and size attributes and returns an FPHTMLBaseFontElement object that represents the BASEFONT element in the specified document.

    Function SetBasefont(objDoc As FPHTMLDocument, strFontFace As String, _
        Optional strFontSize As String) As FPHTMLBaseFontElement
    Dim objBody As FPHTMLBody
    Dim objTemp As FPHTMLBaseFontElement
    Set objBody = objDoc.body
    If objBody.all.tags("basefont").Length <= 0 Then
        objBody.insertAdjacentHTML "afterbegin", "<Basefont>"
        Set objTemp = objBody.all.tags("basefont").Item(0)
        Set objTemp = objBody.all.tags("basefont").Item(0)
    End If
    With objTemp
        .face = strFontFace
        If Len(strFontSize) > 0 Then .Size = strFontSize
    End With
    Set SetBasefont = objTemp
End Function

Use the following example to call the preceding function.

    Sub CallSetBasefont()
    Call SetBasefont(ActiveDocument, "tahoma", "5")
End Sub

Parent Objects