Background
I add an add-in that did the following thing: For all the powerpoint objects selected (example 4 rectangles), the add-in would resize all objects height and width to match the height and width of the biggest object in the selection.
I tried to write a VBA macro to copy this add-in but nothing happens (adapting the code found in the following question: Powerpoint VBA Macro to copy object's size and location and paste to another object):
Sub test()
Dim w As Double
Dim h As Double
Dim obj As Shape
w = 0
h = 0
For i = 1 To ActiveWindow.Selection.ShapeRange.Count
Set obj = ActiveWindow.Selection.ShapeRange(i)
If obj.Width > w Then
w = obj.Width
Else
obj.Width = w
End If
If obj.Height > h Then
h = obj.Height
Else
obj.Height = h
End If
Next
End Sub
Question
Any idea on how to make this code works?