FPHTMLBaseFontElement Object

FPHTMLBaseFontElement
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)
    Else
        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

Properties | all Property | children Property | className Property | color Property | Document Property | face Property | filters Property | id Property | innerHTML Property | innerText Property | isTextEdit Property | lang Property | language Property | offsetHeight Property | offsetLeft Property | offsetParent Property | offsetTop Property | offsetWidth Property | onafterupdate Property | onbeforeupdate Property | onclick Property | ondataavailable Property | ondatasetchanged Property | ondatasetcomplete Property | ondblclick Property | ondragstart Property | onerrorupdate Property | onfilterchange Property | onhelp Property | onkeydown Property | onkeypress Property | onkeyup Property | onmousedown Property | onmousemove Property | onmouseout Property | onmouseover Property | onmouseup Property | onrowenter Property | onrowexit Property | onselectstart Property | outerHTML Property | outerText Property | parentElement Property | parentTextEdit Property | recordNumber Property | size Property | sourceIndex Property | style Property | tagName Property | title Property

Methods | click Method | contains Method | getAttribute Method | insertAdjacentHTML Method | insertAdjacentText Method | removeAttribute Method | scrollIntoView Method | setAttribute Method | toString Method

Events | onafterupdate Event | onbeforeupdate Property | onclick Event | ondataavailable Event | ondatasetchanged Event | ondatasetcomplete Event | ondblclick Event | ondragstart Event | onerrorupdate Event | onfilterchange Event | onhelp Event | onkeydown Property | onkeypress Event | onkeyup Event | onmousedown Event | onmousemove Event | onmouseout Event | onmouseover Event | onmouseup Event | onrowenter Event | onrowexit Event | onselectstart Event

Parent Objects

Child Objects | IHTMLElement Object | IHTMLFiltersCollection Object | IHTMLStyle Object