Class ChartFont (Word VBA)

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


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

Dim cft as ChartFont
Set cft = ActiveDocument.Background.Chart.DataTable.Font

The following procedures can be used to set variables of type ChartFont: ChartCharacters.Font, DataTable.Font, LegendEntry.Font and TickLabels.Font


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

ActiveDocument.Background.Chart.DataTable.Font.Background = xlBackgroundAutomatic

Bold true if the font is bold.

ActiveDocument.Background.Chart.DataTable.Font.Bold = True

Color returns or sets the primary color of the object.

ActiveDocument.Background.Chart.DataTable.Font.Color = RGB(0,0,255)'blue

ColorIndex returns or sets the color of the font.

ActiveDocument.Background.Chart.DataTable.Font.ColorIndex =

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

ActiveDocument.Background.Chart.DataTable.Font.FontStyle =

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

ActiveDocument.Background.Chart.DataTable.Font.Italic = True

Name returns or sets the name of the string. Read/write String.

ActiveDocument.Background.Chart.DataTable.Font.Name =

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

Dim objParent As Object
Set objParent = ActiveDocument.Background.Chart.DataTable.Font.Parent

Size returns or sets the size of the font.

ActiveDocument.Background.Chart.DataTable.Font.Size =

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

ActiveDocument.Background.Chart.DataTable.Font.StrikeThrough = True

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

ActiveDocument.Background.Chart.DataTable.Font.Subscript = True

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

ActiveDocument.Background.Chart.DataTable.Font.Superscript = True

Underline returns or sets the type of underline applied to the font. Can be one of the XlUnderlineStyle constants. Read/write Variant.

ActiveDocument.Background.Chart.DataTable.Font.Underline = xlUnderlineStyleDouble