1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Sub Switch(pptDoc As PowerPoint.Presentation, FindString As String, ReplaceString As Variant)
With pptDoc
For Each oSld In .Slides
For Each oShp In oSld.Shapes
If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
Set oTxtRng = oShp.TextFrame.TextRange
Set oTxtFnd = oTxtRng.Find(FindWhat:=FindString)
Do While Not oTxtFnd Is Nothing
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, Replacewhat:=ReplaceString, After:=0, MatchCase:=True, WholeWords:=False)
Set oTxtFnd = oTxtRng.Find(FindWhat:=FindString)
Loop
Else: Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, Replacewhat:=ReplaceString, After:=0, MatchCase:=True, WholeWords:=False)
Do While Not oTmpRng Is Nothing
Set oTmpRng = oTxtRng.Replace(FindWhat:=FindString, Replacewhat:=ReplaceString, After:=0, MatchCase:=True, WholeWords:=False)
Loop
End If
End If
Next oShp
Next oSld
End With
End Sub |
Partager