Remove [LegendLayers]

The Remove method removes a layer from the legend collection.

Syntax

object.Remove(LayerName)

Parameter

Type

Description

LayerName

String

Required. Specify the name of the layer to remove.

Remarks

The layer name must be unique. For Remove you cannot delete the last layer if there is only one.

Example

This example demonstrates how to remove the map layer named "Classed Post-demogrid.dat" from the legend.

Set Legend = doc.AddLegend

Legend.LegendLayers.Remove("Classed Post-demogrid.dat")

Used by: LegendLayers collection