Luci C
Luci C

Reputation: 199

Change Font/Paragraph Spacing/Change Slide size VBA Powerpoint 2013

I want to do several things to a presentation in Powerpoint 2013:

This is what I have:

Sub use()

 Dim oSl As Slide
 Dim osh As Shape
 For Each oSl In ActivePresentation.Slides
    For Each osh In oSl.Shapes
        If osh.HasTextFrame Then
        With osh.TextFrame.TextRange
           .ParagraphFormat.Alignment = ppAlignCenter
           .ParagraphFormat.SpaceBefore = 0
        End With
        With osh.TextFrame.TextRange
           With .Font
           .Name = "Times New Roman"
           .Italic = False
           .Size = "53"
           End With
        End With
        With ActivePresentation.PageSetup
        .SlideHeight = 19.05
        .SlideWidth = 27.508

        End If
 Next
 Next ' slide

End Sub

Upvotes: 1

Views: 10498

Answers (1)

Luci C
Luci C

Reputation: 199

here is final version which works as wanted:

Sub use()

Dim s As Slide
Dim shp As Shape


For Each s In ActivePresentation.Slides

    For Each shp In s.Shapes
        If shp.HasTextFrame Then
            With shp
            .TextFrame.TextRange.Font.Name = "Times New Roman"
            .TextFrame.TextRange.Font.Size = 53
            .TextFrame.TextRange.Font.Bold = True

                With .TextFrame.TextRange
                 .ParagraphFormat.SpaceBefore = 0
                 End With

            End With
            With ActivePresentation.PageSetup
            .SlideWidth = 779.754330709
            .SlideHeight = 540
            End With

        End If
    Next shp

Next s
End Sub

Upvotes: 2

Related Questions