E
Edward Thrashcort
I'm trying to select all the phrases in a document that are written in a
particular character style and replace them with a PREFIX followed by a
SUFFIX. So let's assume that I have specified a character font for
numerals and assigned it only to the numbers in the following range...
abc 123 xyz 999 pqr
it would be replaced with
abc PREFIX123456SUFFIX wxy PREFIX999SUFFIX pqr
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.Forward = True
.Wrap = wdFindContinue
.Style = ActiveDocument.Styles("Numeral Font")
.Text = "(*)"
.Replacement.Text = "PREFIX\1SUFFIX"
'For testing I'll replace both separately
'The code should be .Execute Replace:=wdReplaceAll
.Execute Replace:=wdReplaceOne
.Execute Replace:=wdReplaceOne
End With
Unfortunately this code only selects the FIRST character then the SECOND
character - not the first phrase and the second phrase
I've also tried
.Text = "(*@)"
.Text = "(?@)"
I've tried
.Format = False
.Format = True (not quite sure what this means anyway!)
but nothing works!
Am I trying to do something that "wildcards" is not capable of performing?
Eddie
particular character style and replace them with a PREFIX followed by a
SUFFIX. So let's assume that I have specified a character font for
numerals and assigned it only to the numbers in the following range...
abc 123 xyz 999 pqr
it would be replaced with
abc PREFIX123456SUFFIX wxy PREFIX999SUFFIX pqr
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.Forward = True
.Wrap = wdFindContinue
.Style = ActiveDocument.Styles("Numeral Font")
.Text = "(*)"
.Replacement.Text = "PREFIX\1SUFFIX"
'For testing I'll replace both separately
'The code should be .Execute Replace:=wdReplaceAll
.Execute Replace:=wdReplaceOne
.Execute Replace:=wdReplaceOne
End With
Unfortunately this code only selects the FIRST character then the SECOND
character - not the first phrase and the second phrase
I've also tried
.Text = "(*@)"
.Text = "(?@)"
I've tried
.Format = False
.Format = True (not quite sure what this means anyway!)
but nothing works!
Am I trying to do something that "wildcards" is not capable of performing?
Eddie