共用方式為


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 支援與意見反應