Class Axis (PowerPoint VBA)

The class Axis represents a single axis in a chart.

The main procedures of class Axis are Delete and Select

Set

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

Dim axi as Axis
Set axi = ActiveWindow.RangeFromPoint.Chart.Axes(Type:=1)

The following procedures can be used to set variables of type Axis: Chart.Axes and Axes.Item

Themes

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

Axis with its procedures AxisBetweenCategories, AxisGroup and AxisTitle
Sort/Order with its procedures Border and ReversePlotOrder
Display/Show with its procedures DisplayUnit, DisplayUnitCustom, DisplayUnitLabel and HasDisplayUnitLabel
Format with its procedures Format, Height, TickLabelSpacing, TickLabelSpacingIsAuto, TickMarkSpacing and Width

Methods

These are the main methods of the Axis class

Delete - Deletes the object.

ActiveWindow.RangeFromPoint.Chart.Axes(1).Delete

Select - Selects the object.

ActiveWindow.RangeFromPoint.Chart.Axes(1).Select

Other Methods

Axes.Item - Returns a single Axis object from an Axes collection.

Dim axi As Axis
Set axi = ActivePresentation.Slides(1).Shapes(1).Chart.Axes(Type:=1)

SetProperty -

Dim strId As String: strId = 
ActiveWindow.RangeFromPoint.Chart.Axes(1).SetProperty Id:=strId, Value:=

Properties

Axes.Count returns the number of objects in the collection.

Dim lngCount As Long
lngCount = ActiveWindow.RangeFromPoint.Chart.Axes.Count

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

Dim objParent As Object
Set objParent = ActiveWindow.RangeFromPoint.Chart.Axes.Parent

BaseUnit returns or sets the base unit for the specified category axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).BaseUnit = xlDays

BaseUnitIsAuto true if Microsoft Word chooses appropriate base units for the specified category axis. The default is True.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).BaseUnitIsAuto = True

CategoryNames returns or sets all the category names as a text array for the specified axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).CategoryNames = Array ("Cow", "Sheep", "Pig")

CategorySortOrder

ActiveWindow.RangeFromPoint.Chart.Axes(1).CategorySortOrder = xlCategoryAscending

CategoryType returns or sets the category axis type.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).CategoryType = xlAutomaticScale

Crosses returns or sets the point on the specified axis where the other axis crosses.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).Crosses = xlAxisCrossesAutomatic

CrossesAt returns or sets the point on the value axis where the category axis crosses it. Applies only to the value axis.

ActiveWindow.RangeFromPoint.Chart.Axes(1).CrossesAt =

HasMajorGridlines true if the axis has major gridlines.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).HasMajorGridlines = True

HasMinorGridlines true if the axis has minor gridlines.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).HasMinorGridlines = True

HasTitle true if the axis or chart has a visible title.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).HasTitle = True

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

Dim dblLeft As Double
dblLeft = ActiveWindow.RangeFromPoint.Chart.Axes(1).Left

LogBase returns or sets the base of the logarithm when you are using log scales.

ActiveWindow.RangeFromPoint.Chart.Axes(1).LogBase =

MajorGridlines returns the major gridlines for the specified axis.

Dim grdsMajorGridlines As Gridlines
Set grdsMajorGridlines = ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MajorGridlines

MajorTickMark returns or sets the type of major tick mark for the specified axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MajorTickMark = xlTickMarkCross

MajorUnit returns or sets the major units for the value axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MajorUnit = 10

MajorUnitIsAuto true if Microsoft Word calculates the major units for the value axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MajorUnitIsAuto = True

MajorUnitScale returns or sets the major unit scale value for the category axis when the CategoryType property is set to xlTimeScale.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MajorUnitScale = xlDays

MaximumScale returns or sets the maximum value on the value axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MaximumScale = 500

MaximumScaleIsAuto true if Microsoft Word calculates the maximum value for the value axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MaximumScaleIsAuto = True

MinimumScale returns or sets the minimum value on the value axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MinimumScale = 50

MinimumScaleIsAuto true if Microsoft Word calculates the minimum value for the value axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MinimumScaleIsAuto = True

MinorGridlines returns the minor gridlines for the specified axis.

Dim grdsMinorGridlines As Gridlines
Set grdsMinorGridlines = ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MinorGridlines

MinorTickMark returns or sets the type of minor tick mark for the specified axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MinorTickMark = xlTickMarkCross

MinorUnit returns or sets the minor units on the value axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MinorUnit = 10

MinorUnitIsAuto true if Microsoft Word calculates minor units for the value axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MinorUnitIsAuto = True

MinorUnitScale returns or sets the minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).MinorUnitScale = xlDays

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

Dim objParent As Object
Set objParent = ActiveWindow.RangeFromPoint.Chart.Axes(1).Parent

ScaleType returns or sets the value axis scale type.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).ScaleType = xlScaleLinear

TickLabelPosition describes the position of tick-mark labels on the specified axis.

ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).TickLabelPosition = xlTickLabelPositionHigh

TickLabels returns the tick-mark labels for the specified axis.

Dim tlsTickLabels As TickLabels
Set tlsTickLabels = ActivePresentation.Slides(1).Shapes(1).Chart.Axes(1).TickLabels

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

Dim dblTop As Double
dblTop = ActiveWindow.RangeFromPoint.Chart.Axes(1).Top

Type returns the axis type.

ActiveWindow.RangeFromPoint.Chart.Axes(1).Type = xlCategory