ShapeRange.Duplicate 方法 (Project)

复制形状区域并返回对副本的引用。

语法

表达式重复

表达 一个代表“ShapeRange”对象的变量。

返回值

ShapeRange

备注

重复形状范围的水平偏移量和垂直偏移量都与原始形状范围相距 12 磅。

示例

以下示例使用 ShapeRange.Apply 方法中的代码示例创建的报表。 该示例复制包含两个形状的形状区域,然后垂直翻转并选择新的形状范围。

Sub DuplicateShapeRange()
    Dim theReport As Report
    Dim shp1 As shape
    Dim shp2 As shape
    Dim shp3 As shape
    Dim reportName As String
    Dim sRange1 As ShapeRange
    Dim sRange2 As ShapeRange
    
    reportName = "Apply Report"
    
    Set theReport = ActiveProject.Reports(reportName)
    Set shp1 = theReport.Shapes(1)
    Set shp2 = theReport.Shapes(2)
    Set shp3 = theReport.Shapes(3)
    
    Set sRange1 = theReport.Shapes.Range(Array(2, 3))
    
    Set sRange2 = sRange1.Duplicate()
    
    sRange2.Flip msoFlipVertical
    sRange2.Select
End Sub

另请参阅

ShapeRange 对象Shape.Duplicate 方法

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。