Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改字体/段落间距/更改幻灯片大小VBA Powerpoint 2013_Vba_Powerpoint - Fatal编程技术网

更改字体/段落间距/更改幻灯片大小VBA Powerpoint 2013

更改字体/段落间距/更改幻灯片大小VBA Powerpoint 2013,vba,powerpoint,Vba,Powerpoint,我想对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

我想对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

以下是最终版本,可根据需要工作:

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

它没有做它应该做的…我可以想出来,你必须描述什么不起作用…它使我的幻灯片大小为2,54厘米x 2,54厘米,它使文本正常,但与间距无关,我有一行一个字母