Shapes オブジェクト (Project)
カスタム レポート内の Shape オブジェクトのコレクションを表します。
例
Shapes コレクション オブジェクトを取得するには、Report.Shapes プロパティを使用します。 次の例では、 Shapes コレクションを取得するには、レポートがアクティブなビューである必要があります。それ以外の場合は、 ステートメントで実行時エラー 424 (オブジェクトが必要) が For Each oShape In oReport.Shapes
発生します。
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 |
値 |
関連項目
Shape オブジェクトレポート オブジェクトShapeRange オブジェクト
サポートとフィードバック
Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。