'Macro to resize all text boxes in a powerpoint presentation

I exported a PDF as a powerpoint presentation. The PDF had A4 pages, while the powerpoint has wide slides (16:9), and the text has ended up being centered in the middle third or so of each slide.

I need to resize all text boxes to fit the wide slides. I've been googling a lot (first day trying to learn how to use macros) and I found something to resize pictures:

Sub Resize()
With ActiveWindow.Selection.ShapeRange
 .Height = 470
 .Width = 900
 .Left = 30
 .Top = 45
End with
End Sub

If I have a text box selected & run the above macro, it is instantly resized to exactly the dimensions I want. The problem is that I then have to move to the next slide, select the text box, and run the macro again.

Is there anyway to automate this so that the entire powerpoint gets edited by running the macro just one time?

Thank yoU!



Solution 1:[1]

In PowerPoint, you iterate through each shape on each slide, testing if the shape is the right kind before resizing it:

Sub BatchChange()
  Dim oSlide As Slide
  Dim oShape As Shape
  For Each oSlide In ActivePresentation.Slides
    For Each oShape In oSlide.Shapes
      If oShape.HasTextFrame Then
        With oShape
          .Height = 470
          .Width = 900
          .Left = 30
          .Top = 45
        End With
      End If
    Next oShape
  Next oSlide
End Sub

If there is more than one shape with a text frame on a slide, they'll be piled on top of one another.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John Korchok