Is it possible to replace the text that was found using wildcard and replace it with wildcard also? for example FindText:="(^13{2}*^13)", Forward:=True, MatchWildcards:=True,
then replace it with wildcard like this replacewith:="(^13{2}*^11)"
. Is it possible?
The entire discussion in Comments is unclear, but I understand that you need to replace only part of the search term, and retain another part. Yes, that's possible by defining expressions in the search term. For example:
Find: "(^13{2}*)^13" Replace: \\1^11
An expression is defined using parentheses. You can have multiple expressions in the "Find" text. Refer to an expression and have Word use it in the replacement using backslash+index, where index is the number (location) of the expression in the Find text. In the above example, taken from your question, there is one expression, so \\1.
I am not a word developer, but just done this, not complete solution, but a good starting point??? : Text was "Nathan testing Nathan testing"
dim x as find
Selection.WholeStory
Set x = Selection.Find
x.Find.ClearFormatting
x.Find.Replacement.ClearFormatting
With x
.Text = "Na*han"
.Replacement.Text = .Text
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
x.Execute
x.Execute Replace:=wdReplaceOne
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.