Powerpoint VBA Macro to copy the size and location of an object and paste into another object

Just switched to Mac from Windows and in ppt on Windows I had an addon that allowed me to copy the properties of an object, including size and / or location, and paste it into another object, sort of like an advanced format, with buttons for the property you want copy.

I no longer have this add-on, but I would really like to create a simple macro to copy the size and location. Is it in the realm of opportunity? If you could provide the code or point me to a resource, where can I teach it to myself?

I spent about 2 hours searching and cannot find a solution for compatibility with Office Mac - so this is my last hope!

+4
source share
1 answer

Here is an example that works. You can adapt it according to 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 
+4
source

All Articles