Project) (Chart.ApplyCustomType 方法

將自訂圖表類型套用至圖表。

語法

expression。 ApplyCustomType (ChartType,TypeName)

expression 代表 Chart 物件的變數。

參數

名稱 必要/選用 資料類型 描述
ChartType 必要 Office.XlChartType 圖表的類型。
TypeName 選用 Variant 圖表類型的名稱。
ChartType 必要 XLCHARTTYPE
TypeName 選用 Variant

傳回值

Nothing

範例

下列範例會將圖表類型變更為群組 3D 橫條圖。

Sub SetChartType()
    Dim chartShape As Shape
    Dim reportName As String
    
    reportName = "Simple scalar chart"
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
    
    Debug.Print "Chart type before: " & chartShape.Chart.ChartType
    chartShape.Chart.ApplyCustomType (xl3DBarClustered)
    Debug.Print "Chart type after: " & chartShape.Chart.ChartType
End Sub

另請參閱

Chart 物件

支援和意見反應

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