Share via


Shape.Duplicate-Methode (Project)

Dupliziert eine Form und gibt einen Verweis auf die Kopie zurück.

Syntax

Ausdruck. Doppelte

Ausdruck Eine Variable, die ein Shape-Objekt darstellt.

Rückgabewert

Form

Beispiel

Im folgenden Beispiel wird der bericht verwendet, der im Codebeispiel in der Shape.Apply-Methode erstellt wurde. Im Beispiel wird eine Form dupliziert und dann gedreht, horizontal gedreht und die neue Form ausgewählt. Der horizontale offset und der vertikale Offset der neuen Form sind beide 12 Punkt.

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

Siehe auch

Shape-ObjektShapeRange.Duplicate-Methode

Support und Feedback

Haben Sie Fragen oder Feedback zu Office VBA oder zu dieser Dokumentation? Unter Office VBA-Support und Feedback finden Sie Hilfestellung zu den Möglichkeiten, wie Sie Support erhalten und Feedback abgeben können.