【问题标题】:Grouping shapes /objects for each slide and flipping it in powerpoint presention为每张幻灯片分组形状/对象并在PowerPoint演示文稿中翻转它
【发布时间】:2020-07-04 01:31:03
【问题描述】:

我是 power-point VBA 的新手,我想对每个 power-point 幻灯片中的所有形状/对象进行分组并将其水平翻转,将所有演示幻灯片中的字体更改为 arial 这是我达到的代码,但它将每个形状单独分组,我无法在翻转之前添加分组,请告知

子 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

【问题讨论】:

    标签: vba powerpoint


    【解决方案1】:

    试试这个:

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-14
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 2020-08-08
      • 2013-06-07
      相关资源
      最近更新 更多