如果幾頁ppt文檔處理起來很快,但是如果上了50頁,改個東西還真是不容易,特別是上了幾百頁的話那,簡直就死機了,這里給您提供一個快速批量設置PowerPoint字體及行間距的宏源碼。
Sub ChangeTextFont()
Set pages = ActivePresentation.Slides.Range
pageCount = pages.Count
'第一頁和最后一頁跳過
For i = 2 To pageCount - 1
DoEvents
ActiveWindow.View.GotoSlide Index:=i
shapeCount = ActiveWindow.Selection.SlideRange.Shapes.Count
For j = 1 To shapeCount
ActiveWindow.Selection.SlideRange.Shapes(j).Select
shapeType = ActiveWindow.Selection.SlideRange.Shapes(j).Type
'1 - 自選圖形
'7 - 公式
'13 - 圖片
'14 - 占位符
'15 - 藝術字
'17 - 文本框
'19 - 表格
'Debug.Print shapeType
Select Case shapeType
Case 1, 14, 17
Set txtRange = ActiveWindow.Selection.ShapeRange.TextFrame.TextRange
txtRange.Select
If txtRange.Text <> "" Then
'設置字體為宋體, 24號
With txtRange.Font
.Name = "宋體"
.Size = 24
End With
'設置段落格式為1.3倍行距
With txtRange.ParagraphFormat
.SpaceWithin = 1.3
End With
End If
Case 7, 13, 15
Case 19
End Select
Next j
Next i
End Sub