次の方法で共有


ShapeRange.Value プロパティ (Project)

ShapeRange コレクション内の個々の Shape オブジェクトを取得します。 読み取り専用 の図形

構文

'ShapeRange' オブジェクトを表す変数。

注釈

ShapeRange オブジェクトの既定のプロパティです。

次の例では、"Test Report" という名前のレポートを作成し、2 つの図形を作成し、 図形を ShapeRange オブジェクトに追加します。 で sRange.Value(1) 始まるステートメントは、図形範囲の最初の図形を取得します。 で sRange(2) 始まる ステートメントは、既定値の Value プロパティを呼び出し、図形範囲内の 2 番目の図形を取得します。

Sub TestShapeRangeValue()
    Dim theReport As Report
    Dim textShape1 As shape
    Dim textShape2 As shape
    Dim reportName As String
    Dim sRange As ShapeRange
    
    reportName = "Test Report"
    
    Set theReport = ActiveProject.Reports.Add(reportName)
    Set textShape1 = theReport.Shapes.AddTextbox(msoTextOrientationHorizontal, 30, 50, 350, 80)
    textShape1.Name = "Text box 1"
    
    Set textShape2 = theReport.Shapes.AddTextbox(msoTextOrientationHorizontal, 30, 130, 350, 80)
    textShape2.Name = "Text box 2"
    
    Set sRange = theReport.Shapes.Range(Array("Text box 1", "Text box 2"))
    
    sRange.TextFrame2.AutoSize = msoAutoSizeShapeToFitText
        
    sRange.Value(1).TextFrame2.TextRange.Text = "This is a test. It's only a test."
    sRange(2).TextFrame2.TextRange.Text = "This is text box 2."
End Sub

プロパティ値

SHAPE

関連項目

ShapeRange オブジェクトShape オブジェクト

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。