LegendKey 对象 (Excel)LegendKey object (Excel)

代表图表图例中的图例标示。Represents a legend key in a chart legend.


每个图例项标示都是一个图形,它将图例项标示以及与之相关联的图表中的系列或趋势线链接起来。Each legend key is a graphic that visually links a legend entry with its associated series or trendline in the chart. 图例项标示链接到与之相关联的系列或趋势线的方式为:更改一个的格式会同时更改另一个的格式。The legend key is linked to its associated series or trendline in such a way that changing the formatting of one simultaneously changes the formatting of the other.


使用LegendEntry对象的**LegendKey** 属性可返回LegendKey对象。Use the LegendKey property of the LegendEntry object to return the LegendKey object.

下面的示例更改名为Sheet1的工作表上嵌入的第一个图表的图例顶部的图例项的标记背景色。The following example changes the marker background color for the legend entry at the top of the legend for embedded chart one on the worksheet named Sheet1. 这将同时更改与该图例项相关联的系列中所有数据点的格式。This simultaneously changes the format of every point in the series associated with this legend entry. 相关的系列必须支持数据标志。The associated series must support data markers.

Worksheets("sheet1").ChartObjects(1).Chart _ 
 .Legend.LegendEntries(1).LegendKey.MarkerBackgroundColorIndex = 5



另请参阅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.