Application.FontEx method (Project)
Sets the font for the text in the active cells.
Syntax
expression. FontEx
( _Name_
, _Size_
, _Bold_
, _Italic_
, _Underline_
, _Color_
, _Reset_
, _CellColor_
, _Pattern_
)
expression A variable that represents an Application object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Name | Optional | String | The name of the font. |
Size | Optional | Integer | The size of the font in points. |
Bold | Optional | Variant | True if the font is bold. |
Italic | Optional | Boolean | True if the font is italic; otherwise, False. |
Underline | Optional | Boolean | True if the font is underlined; otherwise, False. |
Color | Optional | Long | The color of the font. Can be one of the PjColor constants. |
Reset | Optional | Boolean | True if the font is reset to its default characteristics. All other arguments are ignored. The default value is False. |
CellColor | Optional | Variant | The color of the cell. Can be one of the PjColor constants. |
Pattern | Optional | Variant | Background pattern of the cell. Can be one of the PjFillPattern constants. |
Return value
Boolean
Remarks
To set the font with an RGB hexadecimal value for color or with a strikethrough format, use the Font32Ex method.
Example
The following example formats selected text using 16-point Tahoma in a red color.
Sub FormatTahoma16()
FontEx Name:="Tahoma", Size:=16, Color:=pjRed
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.