Class Font (Excel VBA)

Contains the font attributes (font name, font size, color, and so on) for an object.

Set

To use a Font class variable it first needs to be instantiated, for example

Dim fnt as Font
Set fnt = ActiveCell.Font

The following procedures can be used to set variables of type Font: AboveAverage.Font, CellFormat.Font, Characters.Font, DataTable.Font, DisplayFormat.Font, FormatCondition.Font, LegendEntry.Font, Phonetic.Font, Phonetics.Font, Range.Font, Style.Font, TableStyleElement.Font, TickLabels.Font, Top10.Font and UniqueValues.Font

Properties

Background returns or sets the type of background for text used in charts. Read/write Variant, which is set to one of the constants of XlBackground.

Bold true if the font is bold.

Color returns or sets the primary color of the object, as shown in the table in the remarks section. Use the RGB function to create a color value.

ColorIndex returns or sets a value that represents the color of the font.

FontStyle returns or sets the font style. Read/write String.

Italic true if the font style is italic. Read/write Boolean.

Name returns or sets a Variant value that represents the name of the string.

Parent returns the parent object for the specified object. Read-only.

Size returns or sets the size of the font.

Strikethrough true if the font is struck through with a horizontal line. Read/write Boolean.

Subscript true if the font is formatted as subscript. False by default.

Superscript true if the font is formatted as superscript; False by default.

ThemeColor returns or sets the theme color in the applied color scheme that is associated with the specified object.

ThemeFont returns or sets the theme font in the applied font scheme that is associated with the specified object.

TintAndShade returns or sets a Single that lightens or darkens a color.

Underline returns or sets the type of underline applied to the font.