Chart.Axes Method (PowerPoint)
Returns a collection of axes on the chart.
Syntax
expression .Axes(Type, AxisGroup)
expression A variable that represents a Chart object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Type |
Optional |
Variant |
The axis to return. Can be one of the following XlAxisType constants: xlValue, xlCategory, or xlSeriesAxis (xlSeriesAxis is valid only for 3-D charts). |
AxisGroup |
Optional |
One of the enumeration values that specifies the axis group. The default is xlPrimary.
Note
3-D charts have only one axis group.
|
Return Value
An Axes object that contains the selected axes from the chart.
Example
Note
Although the following code applies to Microsoft Word, you can readily modify it to apply to PowerPoint.
The following example adds an axis label to the category axis for the first chart in the active document.
With ActiveDocument.InlineShapes(1)
If .HasChart Then
With .Chart.Axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "July Sales"
End With
End If
End With
The following example turns off major gridlines in the category axis for the first chart in the active document.
With ActiveDocument.InlineShapes(1)
If .HasChart Then
.Chart.Axes(xlCategory). _
HasMajorGridlines = False
End If
End With
The following example turns off all gridlines for all axes in the first chart of the active document.
With ActiveDocument.InlineShapes(1)
If .HasChart Then
For Each a In .Chart.Axes
a.HasMajorGridlines = False
a.HasMinorGridlines = False
Next
End If
End With