0
votes

I'm new in power-point VBA and I would like to group all shapes /objects in each power-point slide and flipping it horizontalchanging the font to arial in all presentaion slides here is the code i reached but it groups each shape as alone and i can't adding the grouping before flipping please advise

Sub DTPMacro()

Dim sld As Slide
Dim shp As Shape
Dim sFontName As String

' Edit this as needed:
sFontName = "Arial"

With ActivePresentation
    For Each sld In .Slides
        For Each shp In sld.Shapes
         shp.Flip msoFlipHorizontal
            With shp
                If .HasTextFrame Then
                    If .TextFrame.HasText Then
                        .TextFrame.TextRange.Font.Name = sFontName
                    End If
                End If
            End With
        Next
    Next
End With

End Sub
1

1 Answers

1
votes

Try this instead:

Sub DTPMacro()

Dim sld As Slide
Dim shp As Shape
Dim grpshp As Shape
Dim sFontName As String

' Edit this as needed:
sFontName = "Arial"

With ActivePresentation
    For Each sld In .Slides
        For Each shp In sld.Shapes
         ' Don't flip the individual shapes
         'shp.Flip msoFlipHorizontal
            With shp
                If .HasTextFrame Then
                    If .TextFrame.HasText Then
                        .TextFrame.TextRange.Font.Name = sFontName
                    End If
                End If
            End With
        Next
        ' group and flip the shapes on the slide here
        Set grpshp = sld.Shapes.Range.Group
        grpshp.Flip msoFlipHorizontal
    Next
End With

End Sub