0 out of 1 rated this helpful - Rate this topic

Gridlines Object (PowerPoint)

Published: July 16, 2012

Represents major or minor gridlines on a chart axis.

Version Added: PowerPoint 2007

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 enable all gridlines for an axis or disable all of them.

Use the MajorGridlines property to return the GridLines object that represents the major gridlines for the axis. Use the MinorGridlines property to return the GridLines object that represents the minor gridlines. It is possible to return both major and minor gridlines at the same time.

Note Note

Although the following code applies to Microsoft Word, you can readily modify it to apply to PowerPoint.

The following example enables major gridlines for the category axis of the first chart in the active document and then formats the gridlines to be blue dashed lines.

With ActiveDocument.InlineShapes(1)

    If .HasChart Then

        With .Chart.Axes(xlCategory)

            .HasMajorGridlines = True

            .MajorGridlines.Border.Color = RGB(0, 0, 255)

            .MajorGridlines.Border.LineStyle = xlDash

        End With

    End If

End With

Community Additions

© 2014 Microsoft. All rights reserved.