Axes Object (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Represents a collection of all the Axis objects in the specified chart.

Use the Axes method to return the Axes collection.

Use Axes(Type, AxisGroup), where Type is the axis type and AxisGroup is the axis group, to return an Axes collection that contains a single Axis object. Type can be one of the following XlAxisType constants: xlCategory, xlSeries, or xlValue. AxisGroup can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary.

The following example displays the number of axes for the first chart in the active document.

With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 MsgBox .Chart.Axes.Count 
 End If 
End With

The following example sets the category axis title text for the first chart in the active document.

With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 With .Chart.Axes(xlCategory) 
 .HasTitle = True 
 .AxisTitle.Caption = "1994" 
 End With 
 End If 
End With
Show: