Class Legend (Excel VBA)
The class Legend represents the legend in a chart. Each chart can have only one legend.
Class Chart gives access to class Legend.
Dim lgn as Legend
Set lgn = ActiveChart.Legend
Methods
Clear - Clears the entire object.
Delete - Deletes the object.
LegendEntries - Returns an legendentries that represents either a single legend entry (a LegendEntry) or a collection of legend entries (a LegendEntries collection) for the legend.
Select - Selects the object.
Properties
Format returns the ChartFormat object.
Height returns or sets a Double value that represents 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 value is True.
Left returns or sets a Double value that represents the distance, in points, from the left edge of the object to the left edge of column A (on a worksheet) or the left edge of the chart area (on a chart).
Name returns a String value that represents the name of the object.
Position returns or sets an XlLegendPosition value that represents the position of the legend on the chart.
Shadow returns or sets a Boolean value that determines if the object has a shadow.
Top returns or sets a Double value that represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart).
Width returns or sets a Double value that represents the width, in points, of the object.
Related Classes
ChartFormat - Provides access to the Office Art formatting for chart elements.
LegendEntries - A collection of all the LegendEntry objects in the specified chart legend.