代表自訂報表中 圖形 物件的集合。
範例
使用 Report.Shapes 屬性取得 Shapes 集合物件。 在下列範例中,報表必須是使用中的檢視,才能取得 [圖形 ] 集合;否則,您會在陳述式中 For Each oShape In oReport.Shapes 收到執行階段錯誤 424 (Object required) 。
Sub ListShapesInReport()
Dim oReports As Reports
Dim oReport As Report
Dim oShape As shape
Dim reportName As String
Dim msg As String
Dim msgBoxTitle As String
Dim numShapes As Integer
numShapes = 0
msg = ""
reportName = "Table Tests"
Set oReports = ActiveProject.Reports
If oReports.IsPresent(reportName) Then
' Make the report the active view.
oReports(reportName).Apply
Set oReport = oReports(reportName)
msgBoxTitle = "Shapes in report: '" & oReport.Name & "'"
For Each oShape In oReport.Shapes
numShapes = numShapes + 1
msg = msg & numShapes & ". Shape type: " & CStr(oShape.Type) _
& ", '" & oShape.Name & "'" & vbCrLf
Next oShape
If numShapes > 0 Then
MsgBox Prompt:=msg, Title:=msgBoxTitle
Else
MsgBox Prompt:="This report contains no shapes.", _
Title:=msgBoxTitle
End If
Else
MsgBox Prompt:="The requested report, '" & reportName _
& "', does not exist.", Title:="Report error"
End If
End Sub
方法
| 名稱 |
|---|
| AddCallout |
| AddChart |
| AddConnector |
| AddCurve |
| AddLabel |
| AddLine |
| AddPolyline |
| AddShape |
| AddTable |
| AddTextbox |
| AddTextEffect |
| BuildFreeform |
| 項目 |
| Range |
| SelectAll |
屬性
| 名稱 |
|---|
| Background |
| Count |
| Default |
| Parent |
| 值 |
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。