Shape.Apply 方法 (Project)

将格式应用于已使用 PickUp 方法复制的格式信息的形状。

语法

表达式应用

表达 一个代表 Shape 对象的变量。

返回值

Nothing

示例

以下示例创建两个柱形形状,将第一个形状设置为红色,复制第一个形状的格式,然后将其应用于第二个形状。

Sub ApplyShapeFormat()
    Dim theReport As Report
    Dim shp1 As shape
    Dim shp2 As shape
    Dim reportName As String
    Dim sRange As ShapeRange
    
    reportName = "Apply Report"
    
    Set theReport = ActiveProject.Reports.Add(reportName)
    Set shp1 = theReport.Shapes.AddShape(msoShapeCan, 10, 30, 100, 100)
    shp1.Name = "Shape 1"
    shp1.Fill.ForeColor.RGB = &H1010FF  ' Red color.
    
    Set shp2 = theReport.Shapes.AddShape(msoShapeCan, 30, 140, 100, 100)
    shp2.Name = "Shape 2"               ' Blue default color.
    
    With theReport
        .Shapes("Shape 1").PickUp
        .Shapes("Shape 2").Apply
    End With
End Sub

另请参阅

Shape 对象PickUp 方法ShapeRange.Apply 方法

支持和反馈

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