Class Legend (PowerPoint VBA)

The class Legend represents the legend in a chart. Each chart can have only one legend.

Class Chart gives access to class Legend.

To use a Legend class variable it first needs to be instantiated, for example

Dim lgn as Legend
Set lgn = ActiveWindow.RangeFromPoint.Chart.Legend

Legend class variables can be set using the Chart.Legend procedure.

Methods

Clear - Clears the entire object.

Delete - Deletes the object.

LegendEntries - Returns a collection of legend entries for the legend.

Select - Selects the object.

Properties

Format returns the line, fill, and effect formatting for the object.

Height returns or sets the height, in points, of the object.

IncludeInLayout true if a legend will occupy the chart layout space when a chart layout is being determined. The default is True.

Left returns the distance, in points, from the left edge of the object to the left edge of the chart area.

Name returns the name of the object.

Position returns or sets the position of the legend on the chart.

Shadow returns or sets a value that indicates whether the object has a shadow.

Top returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart).

Width returns or sets the width, in points, of the object.

ChartFormat - Provides access to the OfficeArt formatting for chart elements.

LegendEntries - A collection of all the LegendEntry objects in the specified chart legend.