在 ShapeRange 集合中取得一個獨立的 Shape 物件。 唯讀 Shape。
語法
表情。價
詞 一個代表「ShapeRange」物件的變數。
註解
Value 是 ShapeRange 物件的預設屬性。
範例
以下範例建立一個名為「Test Report」的報告,建立兩個形狀,然後將這些形狀加入 ShapeRange 物件中。 以 開頭 sRange.Value(1) 的陳述取得形狀範圍中的第一個形狀。 以 開頭的 sRange(2) 陳述會呼叫預設 的 Value 屬性,並取得該形狀範圍內的第二個形狀。
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
屬性值
樣
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。