取得 ShapeRange 集合中的個別 Shape 物件。 唯讀 圖形。
語法
運算式。值
運算式 代表 'ShapeRange' 物件的變數。
註解
Value 是 ShapeRange 物件的預設屬性。
範例
下列範例會建立名為「測試報表」的報表、建立兩個圖形,然後將圖形新增至 ShapeRange 物件。 開頭 sRange.Value(1) 的陳述式會取得圖形範圍內的第一個圖形。 開頭為 的 sRange(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
屬性值
圖形
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。