複製圖形的格式化。
語法
表情。接球
expression 一個用於表示 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
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。