Project) (ShapeRange.PickUp 方法

複製圖形範圍的格式設定。

語法

運算式。取貨

運算式 代表 'ShapeRange' 物件的變數。

傳回值

Nothing

註解

使用 Apply 方法將複製的格式套用至其他圖形或圖形範圍。

範例

下列範例會建立三個圓柱形圖形、將第一個圖形變成紅色、將第二個和第三個圖形新增至圖形範圍、複製第一個圖形的格式設定,然後將格式設定套用至圖形範圍。

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 物件Apply 方法Shape.PickUp 方法

支援和意見反應

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