复制形状的格式。
语法
表达式。拾取
expression 一个代表 Shape 对象的变量。
返回值
Nothing
备注
使用 Apply 方法将复制的格式应用到另一个形状。
示例
以下示例创建两个圆柱形形状,将第一个形状着色为红色,复制第一个形状的格式设置,然后将其应用到第二个形状。
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
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。