Project) (Chart.Legend 屬性

取得代表圖表圖例的 Office.IMsoLegend 物件。 唯讀 IMsoLegend。

語法

運算式。圖例

expression 代表 Chart 物件的變數。

範例

下列範例會開啟圖表的圖例,然後將圖例的頂端設定得比先前設定的低 20 點。

Sub SetLegendTop()
    Dim chartShape As Shape
    Dim reportName As String
    Dim legendTop As Double
    
    reportName = "Simple scalar chart"
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
    
    chartShape.Chart.HasLegend = True
    legendTop = chartShape.Chart.Legend.Top
    chartShape.Chart.Legend.Top = legendTop + 20
End Sub

屬性值

IMSOLEGEND

另請參閱

Chart 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。