選取圖形。
語法
運算式。選取 (取代)
expression 一個用於表示 Shape 物件的變數。
參數
| 名稱 | 必要/選用 | 資料類型 | 描述 |
|---|---|---|---|
| Replace | 選用 | Variant | True 會以新的選取範圍取代目前的選取範圍。 False 會 將新的選取範圍新增到目前的選取範圍。 預設值為 True。 |
| Replace | 選用 | Variant |
傳回值
Nothing
範例
下列範例會建立三個圖形,然後選取每個圖形。 由於第二個和第三個選取範圍會新增到第一個選取範圍,因此會選取所有三個圖形 (請參閱圖 1) 。
Sub SelectShapes()
Dim theReport As Report
Dim shp1 As shape
Dim shp2 As shape
Dim shp3 As shape
Dim reportName As String
reportName = "Select Report"
Set theReport = ActiveProject.Reports.Add(reportName)
Set shp1 = theReport.Shapes.AddShape(msoShapeActionButtonHelp, 20, 50, 20, 30)
Set shp2 = theReport.Shapes.AddShape(msoShapeBalloon, 100, 50, 30, 50)
Set shp3 = theReport.Shapes.AddShape(msoShapeWave, 140, 50, 30, 50)
shp1.Select
shp2.Select False
shp3.Select False
End Sub
圖 1: 使用 Select 方法新增至選取範圍
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。