按下ALT+F11,打开VBE对话框,单击插入——模块,复制下面的代码,按F5键运行就可以完成PPT行间距设置。
Sub SetAllParagraphSpacing()
Dim slide As slide
Dim shape As shape
Dim txtRange As TextRange
' 遍历每个幻灯片
For Each slide In ActivePresentation.Slides
' 遍历幻灯片上的每个形状
For Each shape In slide.Shapes
' 检查形状是否含有文本
If shape.HasTextFrame Then
If shape.TextFrame.HasText Then
Set txtRange = shape.TextFrame.TextRange
With txtRange.ParagraphFormat
.SpaceWithin = 2 ' 设置段落行距为1.3倍
End With
End If
End If
Next shape
Next slide
End Sub