複製一個形狀並回傳該複製品的參考。
語法
表情。摹
expression 一個用於表示 Shape 物件的變數。
傳回值
圖形
範例
以下範例使用了 Shape.Apply 方法中程式碼範例所建立的報告。 範例中複製了一個形狀,然後旋轉、水平翻轉,並選擇新的形狀。 新形狀的水平偏移和垂直偏移量都是12點。
Sub DuplicateShape()
Dim theReport As Report
Dim shp1 As shape
Dim duplicatedShape As shape
Dim reportName As String
reportName = "Apply Report"
Set theReport = ActiveProject.Reports(reportName)
Set shp1 = theReport.Shapes(1)
Set duplicatedShape = shp1.Duplicate
pos1 = shp1.left
pos2 = duplicatedShape.left
Debug.Print "Horizontal offset: " & CStr(pos2 - pos1)
pos1 = shp1.top
pos2 = duplicatedShape.top
Debug.Print "Vertical offset: " & CStr(pos2 - pos1)
duplicatedShape.Rotation = 30
duplicatedShape.Flip msoFlipHorizontal
duplicatedShape.Select
End Sub
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。