複製圖形並傳回複本參照。
語法
運算式。[同步顯示]
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 支援與意見反應。