How can I combine the code for Search + Replace?
Hi there,
For certain documents I'm using this code to make automatisch Search + Replace, but the code is getting very long.
Is there a way to combine, strip or trim this code, as most of it is the same for every change?
In that case I will have a better view of what I'm doing, instead of a code with 2000+ rules.
Thank you for your time.
Yolanda
Sub Ams1()
'
' Ams1 Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End Sub
|