Powerpoint VBA Macro to copy object's size and location and paste to another object

后端 未结 1 477
难免孤独
难免孤独 2021-01-14 02:26

Just switched to Mac from Windows and in ppt on Windows I had an addin that allowed me to copy an object\'s properties including size and/or location and paste it to another

相关标签:
1条回答
  • 2021-01-14 02:48

    Here's an example that works. You can adapt it to suit your specific needs.

    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
    
    0 讨论(0)
提交回复
热议问题