Legend 物件 (Excel)Legend object (Excel)

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

註解Remarks

Legend 物件包含一個或多個 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 ,將會失敗 Legend 物件的屬性及方法。If this property is False, properties and methods of the Legend object will fail.

範例Example

使用Chart物件的**圖例** 屬性可傳回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.