Class LegendEntry (Excel VBA)

The class LegendEntry represents a legend entry in a chart legend.

Member in collection

Item

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

Dim lgne as LegendEntry
Set lgne = ActiveChart.Legend.LegendEntries(Index:=1)

LegendEntry class variables can be set using the LegendEntries.Item procedure.

For Each

Here is an example of processing the LegendEntry items in a collection.

Dim lgneLegendEntrie As LegendEntry
For Each lgneLegendEntrie In ActiveChart.Legend.LegendEntries()
	
Next lgneLegendEntrie

LegendEntries.Item - Returns a single object from a collection.

Delete - Deletes the object.

Select - Selects the object.

Properties

LegendEntries.Count returns a Long value that represents the number of objects in the collection.

Font returns a Font object that represents the font of the specified object.

Format returns the ChartFormat object.

Height returns a Double value that represents the height, in points, of the object.

Index returns a Long value that represents the index number of the object within the collection of similar objects.

Left returns a Double value that represents the distance, in points, from the left edge of the object to the left edge of the chart area.

LegendKey returns a LegendKey object that represents the legend key associated with the entry.

Top returns 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 a Double value that represents the width, in points, of the object.

ChartFormat - Provides access to the Office Art formatting for chart elements.

Font - Contains the font attributes (font name, font size, color, and so on) for an object.

LegendKey - Represents a legend key in a chart legend.