Class DisplayUnitLabel (Word VBA)

The class DisplayUnitLabel represents a unit label on an axis in the specified chart.

The main procedures of class DisplayUnitLabel are Delete and Select


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

Dim dul as DisplayUnitLabel
Set dul = ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel

DisplayUnitLabel class variables can be set using the Axis.DisplayUnitLabel procedure.


Some procedures in this class have been grouped together in themes and are described on separate theme pages

Format with its procedures Format and IncludeInLayout
Formula with its procedures Formula, FormulaLocal, FormulaR1C1 and FormulaR1C1Local


These are the main methods of the DisplayUnitLabel class

Delete - Deletes the object.


Select - Selects the object.



Caption returns or sets the display unit label text.

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Caption =

Characters returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.

Dim ccsCharacters As ChartCharacters
Set ccsCharacters = ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Characters

Height returns the height, in points, of the object.

Dim dblHeight As Double
dblHeight = ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Height

HorizontalAlignment returns or sets the horizontal alignment for the specified object.

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.HorizontalAlignment = xl3DBar

Left returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area.

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Left =

Name returns the name of the object.

Dim strName As String
strName = ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Name

Orientation returns or sets the text orientation. Read/write Long.

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Orientation =

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

Dim objParent As Object
Set objParent = ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Parent

Position returns or sets the position of the unit label on an axis in the chart.

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Position = xlChartElementPositionAutomatic

ReadingOrder returns or sets an XlReadingOrder constant that represents the reading order for the specified object.

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.ReadingOrder =

Shadow returns or sets a value that indicates whether the object has a shadow.

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Shadow = True

Text returns or sets the text for the specified object.

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Text =

Top returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart).

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Top =

VerticalAlignment returns or sets the vertical alignment of the specified object.

ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.VerticalAlignment = xl3DBar

Width returns the width, in points, of the object.

Dim dblWidth As Double
dblWidth = ActiveDocument.Background.Chart.Axes(1).DisplayUnitLabel.Width