title: Powerpoint Macro to center align a single text box to slide
body: <p>I am trying to center align the text boxes in a large presentation. Each slide contains various shapes, but only has one text box with text in it, and I would like that text box aligned to the center of the slide. At the moment, I have a line of code that will make the text center aligned within its own text box, but I was wondering if there was a way of making the text box in the middle of the slide?</p>
  
  <pre><code>    Sub TextSize()
  
      Dim oSl As Slide
      Dim oSh As Shape
  
  
      With ActivePresentation
  
  For Each oSl In .Slides
      For Each oSh In oSl.Shapes
          With oSh
              If .HasTextFrame Then
                  If .TextFrame.HasText Then
                      .TextFrame.TextRange.Font.Size = 26.5
  
                      ' change the code to make the text box centre aligned to the slide
                      .TextFrame.TextRange.ParagraphFormat.Alignment = ppAlignCenter
  
  
                  End If
              End If
          End With
      Next
  Next
  
      End With
  
      End Sub
  </code></pre>