I am a very beginner with VBA, I hope this is a simple question but I can’t figure it out. I need to create a macro which changes the size and the position of a shape which has a specific name. I have different shapes named the same in different slides, and I want that the macro changes the size and the position of all the shapes with that specific name in my powerpoint presentation. I came up with this code but (of course) it gets stuck when it finds a slide which does not include any shapes named “X” in this example.
Thanks
Sub Resize_X()
Dim oSl As slide
Dim Obj As Object
Dim Obj_Left As Long
Dim Obj_Top As Long
Dim Obj_Height As Long
Dim Obj_Width As Long
For Each oSl In ActivePresentation.Slides
Set Obj = oSl.Shapes("X")
With ActivePresentation.PageSetup
Obj_Left = Obj.Left
Obj_Top = Obj.Top
Obj_Height = Obj.Height
Obj_Width = Obj.Width
Obj.LockAspectRatio = True
Obj.Width = 28.3464567 * 25
Obj.Left = (.SlideWidth \ 2) - (Obj.Width \ 2)
Obj.Top = (.SlideHeight \ 2) - (Obj.Height \ 2)
End With
Next oSl
End Sub