更改字体/段落间距/更改幻灯片大小 VBA Powerpoint 2013
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15245195/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 19:53:32 来源:igfitidea点击:
Change Font/Paragraph Spacing/Change Slide size VBA Powerpoint 2013
提问by Luci C
I want to do several things to a presentation in Powerpoint 2013:
我想对 Powerpoint 2013 中的演示文稿做几件事:
- change Font to all text to "Times New Roman" size 53, Bold
- change Paragraph Spacing Before to 0
- change slide size to 27.508 x 19.05 cm
- 将所有文本的字体更改为“Times New Roman”大小 53,粗体
- 将之前的段落间距更改为 0
- 将幻灯片大小更改为 27.508 x 19.05 厘米
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
回答by Luci C
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