Chart.HasAxis property (Project)

Gets or sets which axes exist on a chart. Read/write Variant.

Syntax

expression.HasAxis

expression A variable that represents a Chart object.

Parameters

Name Required/Optional Data type Description
axisType Required Variant The axis type. Series axes apply only to 3D charts. Can be one of the Office.XlAxisType constants.
AxisGroup Optional Variant The axis group. 3D charts have only one set of axes. Can be one of the Office.XlAxisGroup constants.

Return value

Period

Remarks

You must enter a value for at least one of the parameters when setting the HasAxis property.

Project may create or delete axes if you change the chart type or the IMsoAxis.AxisGroup, IMsoChartGroup.AxisGroup, or IMsoSeries.AxisGroup properties.

Example

The following example turns on the primary value axis for the chart.

Sub SetPrimaryAxis()
    Dim chartShape As Shape
    Dim reportName As String
    
    reportName = "Simple scalar chart"
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
    
    chartShape.Chart.HasAxis(Office.XlAxisType.xlValue, Office.XlAxisType.xlPrimary) = True
End Sub

Property value

VARIANT

See also

Chart Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.