fontSize Property
Sets or returns a String that represents the size of the font used for text in the object.
expression.fontSize
*expression * Required. An expression that returns one of the objects in the Applies To list.
Remarks
The String value for the fontSize property can be one of the following:
absolute-size |
Set of keywords that indicate predefined font sizes. Possible keywords include [ xx-small |x-small | small | medium | large | x-large | xx-large ]. Named font sizes scale according to the user's font setting preferences. |
relative-size |
Set of keywords that are interpreted as relative to the font size of the parent object. Possible values include [ larger | smaller ]. |
length |
Floating-point number, followed by an absolute units designator (cm , mm , in , pt , pc , or px ) or a relative units designator (em or ex ). |
percentage |
Integer, followed by a % . The value is a percentage of the parent object's font size. In Internet Explorer 3.0, the value is calculated as a percentage of the default font size. |
The default value of the fontSize property is medium. The cascading style sheets (CSS) attribute is inherited.
Example
This example inserts a new paragraph containing the current user's name into the active document, and then formats the font characteristics.
Sub FontFaceSource()
Dim objPara As FPHTMLParaElement
ActiveDocument.body.insertAdjacentHTML where:="beforeend", _
HTML:="<p id=""username"">" & Application.UserName & "</p>"
Set objPara = ActiveDocument.body.all.tags("p").Item("username")
With objPara.Style
.fontFamily = "Tahoma"
.FONTSIZE = "40pt"
.fontStyle = Italic
.fontVariant = "small-caps"
.fontWeight = "bold"
End With
End Sub
Applies to | FPHTMLStyle Object | IFPStyleState Object | IHTMLRuleStyle Object | IHTMLStyle Object