Shape.Duplicate 方法 (Visio)Shape.Duplicate Method (Visio)

重复对象。Duplicates an object.


expressionexpression. Duplicate

_表达式_代表Shape对象的变量。expression A variable that represents a Shape object.

返回值Return value



Duplicate方法重复的指定的对象或选定内容,并将副本添加到与原始相同的页。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.

当用于Shape对象,则Duplicate方法重复形状。When used with a Shape object, the Duplicate method duplicates the shape.

当用于Selection对象,则Duplicate方法重复选定内容。When used with a Selection object, the Duplicate method duplicates the selection.


下面的示例演示如何复制Shape对象。The following example shows how to duplicate Shape objects. 代码还适用于Selection对象。The code also works for Selection objects.

运行以下宏之前,请确保绘图页在 Microsoft Visio 窗口中处于活动状态。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