Class LegendKey (PowerPoint VBA)

The class LegendKey represents a legend key in a chart legend.

The main procedure of class LegendKey is Delete


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

Dim lky as LegendKey
Set lky = ActiveWindow.RangeFromPoint.Chart.Legend.LegendEntries(1).LegendKey

LegendKey class variables can be set using the LegendEntry.LegendKey procedure.


Some procedures in this class have been grouped together in themes and are described on separate theme pages

Format with its procedures ClearFormats, Format, Height, MarkerBackgroundColor, MarkerBackgroundColorIndex, MarkerForegroundColor, MarkerForegroundColorIndex, MarkerStyle and Width
Picture with its procedures PictureType and PictureUnit2


This is the main method of the LegendKey class

Delete - Deletes the object.



InvertIfNegative true if Microsoft Word inverts the pattern in the object when it corresponds to a negative number.

ActiveWindow.RangeFromPoint.Chart.Legend.LegendEntries(1).LegendKey.InvertIfNegative = True

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

Dim dblLeft As Double
dblLeft = ActiveWindow.RangeFromPoint.Chart.Legend.LegendEntries(1).LegendKey.Left

MarkerSize returns or sets the data-marker size, in points.

ActiveWindow.RangeFromPoint.Chart.Legend.LegendEntries(1).LegendKey.MarkerSize =

Parent returns the parent for the specified object. Read-only object.

Dim objParent As Object
Set objParent = ActiveWindow.RangeFromPoint.Chart.Legend.LegendEntries(1).LegendKey.Parent

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

ActiveWindow.RangeFromPoint.Chart.Legend.LegendEntries(1).LegendKey.Shadow = True

Smooth true if curve smoothing is turned on for the legend key.

ActiveWindow.RangeFromPoint.Chart.Legend.LegendEntries(1).LegendKey.Smooth = True

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

Dim dblTop As Double
dblTop = ActiveWindow.RangeFromPoint.Chart.Legend.LegendEntries(1).LegendKey.Top