共用方式為


Word) (Chart 物件

代表文件中的圖表。

註解

範例一節說明下列屬性和方法傳回 Chart 物件:

範例

InlineShapes 集合中含有每個內嵌圖形、 圖表,包括文件中的物件。 使用 InlineShapes (索 ) ,其中 Index 是內嵌圖案的索引編號,可傳回單一 InlineShape 物件。 使用 HasChart 屬性來判斷 InlineShape 物件是否代表圖表。 HasChart 屬性設為 True ,如果使用的 圖表 屬性可傳回 Chart 物件。

您也可以使用 Type 屬性來判斷是否 InlineShape 物件代表圖表。 如果 Type 屬性設為 WdInlineShapeChart 、 內置圖案會代表圖表。

下列範例會驗證使用中文件內的第一個內嵌圖案是否代表圖表。 若是,則此範例會變更該圖表上第一個數列的前景色彩。

With ActiveDocument.InlineShapes(1) 
 If .HasChart Then 
 .Chart.SeriesCollection(1).Format.Fill.ForeColor.RGB = rgbRed 
 End If 
End With

下列範例會建立新的 3D 直條圖,並將其新增至使用中檔。

ActiveDocument.InlineShapes.AddChart Type:=xl3DColumn 

方法

名稱
ApplyChartTemplate
ApplyDataLabels
ApplyLayout
Axes
ChartWizard
ClearToMatchColorStyle
ClearToMatchStyle
Copy
CopyPicture
Delete
Export
FullSeriesCollection
GetChartElement
Paste
Refresh
SaveChartTemplate
Select
SeriesCollection
SetBackgroundPicture
SetDefaultChart
SetElement
SetSourceData

屬性

名稱
Application
AutoScaling
BackWall
BarShape
CategoryLabelLevel
ChartArea
ChartColor
ChartData
ChartGroups
ChartStyle
ChartTitle
ChartType
Creator
DataTable
DepthPercent
DisplayBlanksAs
Elevation
Floor
GapDepth
HasAxis
HasDataTable
HasLegend
HasTitle
HeightPercent
Legend
Parent
Perspective
PivotLayout
PlotArea
PlotBy
PlotVisibleOnly
RightAngleAxes
Rotation
SeriesNameLevel
Shapes
ShowAllFieldButtons
ShowAxisFieldButtons
ShowDataLabelsOverMaximum
ShowLegendFieldButtons
ShowReportFilterFieldButtons
ShowValueFieldButtons
SideWall
Walls

另請參閱

Word 物件模型參考資料

支援和意見反應

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