Legend 对象 (Excel)Legend object (Excel)

代表图标中的图例。Represents the legend in a chart. 每个图表只能有一个图例。Each chart can have only one legend.

备注Remarks

图例 对象都包含一个或多个 LegendEntry 对象;每个 LegendEntry 对象包含一个 LegendKey 对象。The Legend object contains one or more LegendEntry objects; each LegendEntry object contains a LegendKey object.

图表图例不可见, 除非**HasLegend** 属性为TrueThe chart legend isn't visible unless the HasLegend property is True. 如果此属性为 False ,则 图例 对象的属性和方法将会失败。If this property is False, properties and methods of the Legend object will fail.

示例Example

使用Chart对象的**legend** 属性可返回Legend对象。Use the Legend property of the Chart object to return the Legend object. 下例将工作表一上嵌入图表一的图例字形设置为加粗。The following example sets the font style for the legend in embedded chart one on worksheet one to bold.

Worksheets(1).ChartObjects(1).Chart.Legend.Font.Bold = True

方法Methods

属性Properties

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.