G
Guest
Hello there,
I've written a subroutine to search and replace text within all shapes in
the Slidemaster, TitleMaster, HandoutMaster and NoteMaster.
The subroutine works well when I try to find and replace one word. As soon
as I search for several words or load the search string via a config file,
nothing is replaced.
The subroutine is below and has been taken from previous posts.
Any ideas what I might be doing wrong ? Should I be doing something to the
search and replace strings before comparing them ?
If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
oTxtRng = oShp.TextFrame.TextRange
oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, MatchCase:=True, _
WholeWords:=True)
Do While Not oTmpRng Is Nothing
oTxtRng = oTxtRng.Characters(oTmpRng.Start +
oTmpRng.Length, _
oTxtRng.Length)
oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, MatchCase:=True, _
WholeWords:=True)
Loop
End If
End If
Thanks
I've written a subroutine to search and replace text within all shapes in
the Slidemaster, TitleMaster, HandoutMaster and NoteMaster.
The subroutine works well when I try to find and replace one word. As soon
as I search for several words or load the search string via a config file,
nothing is replaced.
The subroutine is below and has been taken from previous posts.
Any ideas what I might be doing wrong ? Should I be doing something to the
search and replace strings before comparing them ?
If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
oTxtRng = oShp.TextFrame.TextRange
oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, MatchCase:=True, _
WholeWords:=True)
Do While Not oTmpRng Is Nothing
oTxtRng = oTxtRng.Characters(oTmpRng.Start +
oTmpRng.Length, _
oTxtRng.Length)
oTmpRng = oTxtRng.Replace(FindWhat:=FindString, _
Replacewhat:=ReplaceString, MatchCase:=True, _
WholeWords:=True)
Loop
End If
End If
Thanks