face Property
Sets or returns a String that represents the font for the specified object.
expression.face
*expression * Required. An expression that returns one of the objects in the Applies To list.
Example
The following example inserts a BASEFONT element into the specified document if one doesn't already exist and formats the font name and, optionally, the font size.
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 subroutine.
Sub CallSetBasefont()
Call SetBasefont(ActiveDocument, "comic sans ms", "5")
End Sub
Applies to | FPHTMLBaseFontElement Object | FPHTMLFontElement Object | IHTMLBaseFontElement Object | IHTMLFontElement Object