LegendKey object (PowerPoint)

Represents a legend key in a chart legend.

Remarks

Each legend key is a graphic that visually links a legend entry with its associated series or trendline in the chart. The legend key is linked to its associated series or trendline in such a way that changing the formatting of one simultaneously changes the formatting of the other.

Example

Note

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

Use the LegendKey property to return the LegendKey object. The following example changes the marker background color for the legend entry at the top of the legend for the first chart in the active document. This simultaneously changes the format of every point in the series associated with this legend entry. The associated series must support data markers.

With ActiveDocument.InlineShapes(1)
    If .HasChart Then
        .Chart.Legend.LegendEntries(1).LegendKey _
            .MarkerBackgroundColorIndex = 5
    End If
End With


See also

PowerPoint Object Model Reference

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.