共用方式為


ShapeRange.Duplicate 方法 (Project)

複製圖案範圍,並傳回復本的參考。

語法

運算式重複

表達 代表 'ShapeRange' 物件的變數。

傳回值

ShapeRange

註解

複製圖案範圍的水準位移和垂直位移都是原始圖案範圍的 12 點。

範例

下列範例會使用 ShapeRange.Apply 方法中程式碼範例所建立的報表。 此範例會複製包含兩個圖案的圖案範圍,然後垂直翻轉並選取新的圖案範圍。

Sub DuplicateShapeRange()
    Dim theReport As Report
    Dim shp1 As shape
    Dim shp2 As shape
    Dim shp3 As shape
    Dim reportName As String
    Dim sRange1 As ShapeRange
    Dim sRange2 As ShapeRange
    
    reportName = "Apply Report"
    
    Set theReport = ActiveProject.Reports(reportName)
    Set shp1 = theReport.Shapes(1)
    Set shp2 = theReport.Shapes(2)
    Set shp3 = theReport.Shapes(3)
    
    Set sRange1 = theReport.Shapes.Range(Array(2, 3))
    
    Set sRange2 = sRange1.Duplicate()
    
    sRange2.Flip msoFlipVertical
    sRange2.Select
End Sub

另請參閱

ShapeRange 物件Shape.Duplicate 方法

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應