Class Legend (PowerPoint VBA)

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

The main procedures of class Legend are Delete and Select

Set

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.

Themes

The following procedures in this class have been grouped together and are described on a separate theme page

Format with its procedures Format, Height, IncludeInLayout and Width

Methods

These are the main methods of the Legend class

Delete - Deletes the object.

ActiveWindow.RangeFromPoint.Chart.Legend.Delete

Select - Selects the object.

ActiveWindow.RangeFromPoint.Chart.Legend.Select

Other Methods

SetProperty -

Dim strId As String: strId = 
ActiveWindow.RangeFromPoint.Chart.Legend.SetProperty Id:=strId, Value:=

Properties

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

ActiveWindow.RangeFromPoint.Chart.Legend.Left =

Name returns the name of the object.

Dim strName As String
strName = ActiveWindow.RangeFromPoint.Chart.Legend.Name

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

Dim objParent As Object
Set objParent = ActiveWindow.RangeFromPoint.Chart.Legend.Parent

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

ActivePresentation.Slides(1).Shapes(1).Chart.Legend.Position = xlLegendPositionBottom

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

ActiveWindow.RangeFromPoint.Chart.Legend.Shadow = True

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

ActiveWindow.RangeFromPoint.Chart.Legend.Top =