共用方式為


Chart.SetElement 方法 (Word)

將圖表上圖表項目。 讀取/寫入 MsoChartElementType

語法

運算式SetElement (元素)

expression 代表 Chart 物件的變數。

參數

名稱 必要/選用 資料類型 描述
元素 必要 MsoChartElementType 其中一個指定圖表項目類型的列舉值。

註解

對於圖表,[ 版面配置] 索引標籤中的下列命令會對應至 SetElement 方法:

  • [標籤] 群組中的每個項目。

  • [座標軸] 群組中的每個項目。

  • [分析] 群組中的每個項目。

  • [@@@繪圖區][圖表牆][圖表底板] 按鈕。

MsoChartElementType 是參照所有上述命令之常數的列舉。

範例

下列範例會利用使用中圖表的各種常數值設定圖表項目。

With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 With .Chart 
 ' Select the major gridlines on the value axis. 
 .Axes(xlValue).MajorGridlines.Select 
 .SetElement msoElementChartTitleCenteredOverlay 
 .SetElement msoElementPrimaryCategoryGridLinesMinor 
 ' Select the walls. 
 .Walls.Select 
 .SetElement msoElementChartFloorShow 
 End With 
 End If 
End With 

另請參閱

Chart 物件

支援和意見反應

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