Share via


MajorGridlines Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Returns a ChGridlines object that represents the major gridlines for the specified axis. Note that you can use gridlines on any axis. Read-only.

expression.MajorGridlines

expression   Required. An expression that returns a ChAxis object.

Example

This example sets the color and line weight for the gridlines on the value axis of the first chart in ChartSpace1.

  Sub Format_Gridlines()
    Dim chConstants
    Dim glMajorGridlines
    Dim glMinorGridlines

    Set chConstants = ChartSpace1.Constants

    ' Set a variable to the major gridlines on the value axis.
    Set glMajorGridlines = ChartSpace1.Charts(0).Axes( _
           chConstants.chAxisPositionValue).MajorGridlines

    ' Set a variable to the minor gridlines on the value axis.
    Set glMinorGridlines = ChartSpace1.Charts(0).Axes( _
           chConstants.chAxisPositionValue).MinorGridlines

    ' Set the color and weight of the major gridlines.
    glMajorGridlines.Line.Color = "white"
    glMajorGridlines.Line.Weight = 5

    ' Set the color and weight of the minor gridlines.
    glMinorGridlines.Line.Color = "yellow"
    glMajorGridlines.Line.Weight = 2
End Sub