共用方式為


Shape.Duplicate 方法 (Project)

複製圖形,並傳回復本的參考。

語法

運算式重複

表達 代表 Shape 物件的變數。

傳回值

圖形

範例

下列範例會使用 Shape.Apply 方法中程式碼範例所建立的報表。 此範例會複製圖形,然後旋轉、水準翻轉,然後選取新圖形。 新圖形的水準位移和垂直位移都是 12 點。

Sub DuplicateShape()
    Dim theReport As Report
    Dim shp1 As shape
    Dim duplicatedShape As shape
    Dim reportName As String
    
    reportName = "Apply Report"
    
    Set theReport = ActiveProject.Reports(reportName)
    Set shp1 = theReport.Shapes(1)
    
    Set duplicatedShape = shp1.Duplicate
    
    pos1 = shp1.left
    pos2 = duplicatedShape.left
    Debug.Print "Horizontal offset: " & CStr(pos2 - pos1)
    
    pos1 = shp1.top
    pos2 = duplicatedShape.top
    Debug.Print "Vertical offset: " & CStr(pos2 - pos1)
   
    duplicatedShape.Rotation = 30
    duplicatedShape.Flip msoFlipHorizontal
    
    duplicatedShape.Select
End Sub

另請參閱

Shape 物件ShapeRange.Duplicate 方法

支援和意見反應

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