Shape.Duplicate method (Project)
Duplicates a shape and returns a reference to the copy.
Syntax
expression.Duplicate
expression A variable that represents a Shape object.
Return value
Shape
Example
The following example uses the report created by the code example in the Shape.Apply method. The example duplicates a shape, and then rotates, horizontally flips, and selects the new shape. The horizontal offset and vertical offset of the new shape are both 12 points.
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
See also
Shape Object ShapeRange.Duplicate Method
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.