我一直在尝试开发一个宏,它将用“Arial”替换演示文稿中的所有字体。到目前为止,我已经成功地替换了文本框、表格和 SmartArt 的字体,但无法替换分组对象中的字体。以下是供参考的代码。有人可以帮忙吗?
子文本字体()
Dim oSl As Slide
Dim oSh As Shape
Dim oTbl As Table
Dim oSmt As SmartArt
Dim oNode As SmartArtNode
Dim lRow As Long
Dim lCol As Long
Dim sFontName As String
sFontName = "Arial"
With ActivePresentation
For Each oSl In .Slides
For Each oSh In oSl.Shapes
With oSh
If .HasTextFrame Then
If .TextFrame.HasText Then
.TextFrame.TextRange.Font.Name = sFontName
End If
End If
End With
Next
Next
End With
For Each oSh In oSl.Shapes
If oSh.HasTable Then
Set oTbl = oSh.Table
For lRow = 1 To oTbl.Rows.Count
For lCol = 1 To oTbl.Columns.Count
With oTbl.Cell(lRow, lCol).Shape.TextFrame.TextRange
.Font.Name = "Arial"
End With
Next
Next
ElseIf oSh.HasSmartArt Then
For Each oNode In oSh.SmartArt.AllNodes
oNode.TextFrame2.TextRange.Font.Name = "Arial"
Next
End If
Next
Next osl End Sub