Table of contents
TOC
Collapse the table of content
Expand the table of content

Selection.Duplicate Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Duplicates a selection.

Syntax

expression . Duplicate

expression A variable that represents a Selection object.

Return Value

Selection

Remarks

The Duplicate method duplicates the specified object or selection and adds a copy to the same page as the original. Using the Duplicate method is equivalent to clicking Duplicate on the Paste menu on the Home tab.

When used with a Shape object, the Duplicate method duplicates the shape.

When used with a Selection object, the Duplicate method duplicates the selection.

Example

The following example shows how to duplicate Shape objects. The code also works for Selection objects.

Before running this macro, make sure a drawing page is active in the Microsoft Visio window.


Public Sub Duplicate_Example() 

 Dim vsoOriginalShape As Visio.Shape 
 Dim vsoDuplicateShape As Visio.Shape 

 Set vsoOriginalShape = ActivePage.DrawLine(1, 1, 5, 5) 

 Set vsoDuplicateShape = vsoOriginalShape.Duplicate 
 vsoDuplicateShape.Cells("BeginY") = "2" 

End Sub
© 2018 Microsoft