共用方式為


ShapeRange.Apply 方法 (Project)

將格式設定套用至圖形範圍,其中已使用 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 物件PickUp 方法Shape.Apply 方法

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應