【问题标题】:Change Font/Paragraph Spacing/Change Slide size VBA Powerpoint 2013更改字体/段落间距/更改幻灯片大小 VBA Powerpoint 2013
【发布时间】:2013-03-06 10:47:01
【问题描述】:

我想对 Powerpoint 2013 中的演示文稿做几件事:

  • 将字体全部更改为“Times New Roman”,大小为 53,粗体
  • 将之前的段落间距更改为 0
  • 将幻灯片尺寸更改为 27.508 x 19.05 厘米

这就是我所拥有的:

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

【问题讨论】:

  • 它没有做它应该做的......我能弄清楚
  • 你必须描述什么不起作用......
  • 它使我的幻灯片尺寸为 2.54 厘米 x 2.54 厘米,它使文本正常,但没有关于间距的问题,而且我连续有一个字母

标签: vba powerpoint


【解决方案1】:

这是最终版本,可以按要求工作:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-07
    • 2018-03-08
    相关资源
    最近更新 更多