Log in

View Full Version : Wildcard Replace, Until find text not found



Rakesh
11-11-2014, 03:19 AM
Hi Guys,

Hi had the below Wildcard replace macro. How to repeat it until the find text = “”


ActiveDocument.Content.Find.execute _
FindText:="(Number of[!^13]@^t)^t", _
MatchWildcards:=True, _
ReplaceWith:="\1", _
replace:=wdReplaceAll


Thanks,

gmayor
11-11-2014, 08:27 AM
I think the following will fulfil what you are trying to achieve:


ActiveDocument.Content.Find.Execute _
FindText:="(Number of)[^t]{1,}", _
MatchWildcards:=True, _
ReplaceWith:="\1" & Chr(9), _
Replace:=wdReplaceAll

macropod
11-11-2014, 02:18 PM
More likely, I think, is:

ActiveDocument.Content.Find.Execute _
FindText:="(Number of[!^13^t]@)[^t]{2,}", _
MatchWildcards:=True, _
ReplaceWith:="\1^t", _
Replace:=wdReplaceAll