|
若是上千页,上述代码自然不是好的解决方案,下面的代码,是优化的代码,效率高一些,继续提供下载。
Sub 批量替换字符()
arr = Array("A", "C", "E", "G", "I", "K", "M") '被替换的字符
brr = Array("B", "D", "F", "H", "J", "L", "N") '替换后的字符
x = LBound(arr)
Z = UBound(arr)
Dim sld As Slide, shp As Shape
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasTextFrame Then
If shp.TextFrame.HasText Then
Set trng = shp.TextFrame.TextRange
For i = x To Z
trng.Replace FindWhat:=arr(i), Replacewhat:=brr(i), WholeWords:=True
Next
End If
End If
Next
Next
End Sub
实例2.zip
(74.45 KB, 下载次数: 13)
|
|