This documentation is archived and is not being maintained.

ChGridlines Object


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.
ChAxis
Aa198410.parchild(en-us,office.10).gifChGridlines
Aa198410.space(en-us,office.10).gifAa198410.parchild(en-us,office.10).gifChLine

Represents major or minor gridlines on a chart axis. You cannot have gridlines without an axis. Gridlines extend the tick marks on a chart axis to make it easier to see the values associated with the data markers. This object is not a collection. There is no object that represents a single gridline; you either have all gridlines for an axis turned on or all of them turned off.

Using the ChGridlines object

The following properties return a ChGridlines object.

The ChAxis object’s MajorGridlines property

The ChAxis object’s MinorGridlines property

The following example enables the major and minor gridlines for the value axis in the first chart in Chartspace1. Then, the weight of the gridlines is formatted.

Sub EnableGridlines()

    Dim chConstants
    Dim axValueAxis

    Set chConstants = ChartSpace1.Constants

    ' Set a variable to the value axis in the first chart in Chartspace1.
    Set axValueAxis = ChartSpace1.Charts(0).Axes(chConstants.chAxisPositionValue)

    ' The following two lines of code turn on the major and
    ' minor gridlines for the value axis.
    axValueAxis.HasMajorGridlines = True
    axValueAxis.HasMinorGridlines = True

    ' The following two lines of code set the line weight of the
    ' major and minor gridlines for the value axis.
    axValueAxis.MajorGridlines.Line.Weight = chConstants.owcLineWeightMedium
    axValueAxis.MinorGridlines.Line.Weight = chConstants.owcLineWeightHairline

End Sub

 

Show: