Project) (ShapeRange.Apply 方法

将格式应用于形状区域,其中已使用 PickUp 方法复制了格式信息。

语法

表达式。应用

表达式 表示 'ShapeRange' 对象的变量。

返回值

Nothing

示例

以下示例创建三个圆柱形形状,将第一个形状涂成红色,将第二个和第三个形状添加到形状范围,复制第一个形状的格式设置,然后将格式设置应用于形状范围。

Sub ApplyShapeFormat()
    Dim theReport As Report
    Dim shp1 As shape
    Dim shp2 As shape
    Dim shp3 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.
    
    ' Blue default color.
    Set shp2 = theReport.Shapes.AddShape(msoShapeCan, 30, 140, 100, 100)
    
    ' Blue default color.
    Set shp3 = theReport.Shapes.AddShape(msoShapeCan, 140, 140, 100, 100)
    
    Set sRange = theReport.Shapes.Range(Array(2, 3))
    
    theReport.Shapes("Shape 1").PickUp
    sRange.Apply
End Sub

另请参阅

ShapeRange 对象拾取方法Shape.Apply 方法

支持和反馈

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