使用 vba 在 powerpoint 中复制一个对象?

Replicate an object in powerpoint using vba?

我想使用 VBA 代码在 powerpoint 中复制选定的对象。我在下面提到了以下代码

    Sub CopySizeAndPosition()

    ' Usage: Select two shapes. The size and position of
    ' the first shape selected will be copied to the second.

    Dim w As Double
    Dim h As Double
    Dim l As Double
    Dim t As Double

    With ActiveWindow.Selection.ShapeRange(1)
        w = .Width
        h = .Height
        l = .Left
        t = .Top
    End With
    With ActiveWindow.Selection.ShapeRange(2)
        .Width = w
        .Height = h
        .Left = l
        .Top = t
    End With 
End Sub

但我想指定我的值而不是获取对象值。所以,请提前帮助和感谢!

假设您选择了一个形状,您可以像这样设置您的值:

' Sets the size and position of the first shape in a selection
Sub SetShapeSizeAndPosition()
  With ActiveWindow.Selection.ShapeRange(1)
    .Width = 100
    .Height = 100
    .Left = 100
    .Top = 100
  End With
End Sub