Table of contents

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

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

重复对象。Duplicates an object.


表达式重复的expression . Duplicate

表达式_一个表示一个Shape对象的变量。_expression A variable that represents a Shape object.

返回值Return Value



重复的方法重复指定的对象或选定内容,并将副本添加到同一原始页。使用此复制方法等效于在主页选项卡上的粘贴菜单上单击重复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对象,复制方法的重复该形状。When used with a Shape object, the Duplicate method duplicates the shape.

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


下面的示例演示如何复制形状的对象。该代码还可用于选择对象。The following example shows how to duplicate Shape objects. 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
© 2018 Microsoft