Class LegendEntry (Excel VBA)

The class LegendEntry represents a legend entry in a chart legend. 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)

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

Delete

Deletes the object.


ActiveChart.Legend.LegendEntries(1).Delete

Font

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


Dim fntFont As Font
Set fntFont = ActiveChart.Legend.LegendEntries(1).Font

Format

Returns the ChartFormat object.


Dim cftFormatted As ChartFormat
Set cftFormatted = ActiveChart.Legend.LegendEntries(1).Format

Height

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


Dim dblHeight As Double
dblHeight = ActiveChart.Legend.LegendEntries(1).Height

Index

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


Dim lngIndex As Long
lngIndex = ActiveChart.Legend.LegendEntries(1).Index

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.


Dim dblLeft As Double
dblLeft = ActiveChart.Legend.LegendEntries(1).Left

LegendKey

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


Dim lkyLegendKey As LegendKey
Set lkyLegendKey = ActiveChart.Legend.LegendEntries(1).LegendKey

Select

Selects the object.


ActiveChart.Legend.LegendEntries(1).Select

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).


Dim dblTop As Double
dblTop = ActiveChart.Legend.LegendEntries(1).Top

Width

Returns a Double value that represents the width, in points, of the object.


Dim dblWidth As Double
dblWidth = ActiveChart.Legend.LegendEntries(1).Width