我們?cè)谂虐鎝pt時(shí)有時(shí)會(huì)碰到ppt內(nèi)每張幻燈片上的文字的字體不統(tǒng)一現(xiàn)象,尤其是排版菜鳥的ppt作品時(shí)或者在排版多人合作的ppt時(shí)經(jīng)常會(huì)出現(xiàn)這種情況。
ppt不像word,word可以提供【樣式】功能或者強(qiáng)大的【查找和替換功】能進(jìn)行批量的修改。
不過ppt內(nèi)可以通過vba代碼快速實(shí)現(xiàn)你的要求:
--------------------------------------------------------------------------------
sub 快速將當(dāng)前演示文稿內(nèi)的字體統(tǒng)一格式化為微軟雅黑()
Dim oSl As Slide
Dim oSh As Shape
Dim sFontName As String
Dim Ctr As Integer
Dim Cl As Cell
sFontName = "微軟雅黑"
With ActivePresentation
For Each oSl In .Slides
For Each oSh In oSl.Shapes
With oSh
Select Case .Type
Case msoGroup
For Ctr = 1 To .GroupItems.Count
If .GroupItems(Ctr).HasTextFrame Then
.GroupItems(Ctr).TextFrame.TextRange.Font.Name = sFontName
.GroupItems(Ctr).TextFrame.TextRange.Font.NameFarEast = sFontName
.GroupItems(Ctr).TextFrame.TextRange.Font.NameOther = sFontName
End If
Next Ctr
Case msoTable
For Ctr = 1 To .Table.Rows.Count
For Each Cl In .Table.Rows(Ctr).Cells
Cl.Shape.TextFrame.TextRange.Font.Name = sFontName
Cl.Shape.TextFrame.TextRange.Font.NameFarEast = sFontName
Cl.Shape.TextFrame.TextRange.Font.NameOther = sFontName
Next Cl
Next Ctr
Case Else
If .HasTextFrame Then
If .TextFrame.HasText Then
.TextFrame.TextRange.Font.Name = sFontName
.TextFrame.TextRange.Font.NameFarEast = sFontName
.TextFrame.TextRange.Font.NameOther = sFontName
End If
End If
End Select
End With
Next
Next
End With
End Sub