I have Word Mail Merge document with merge codes inserted. I was wondering if I can write a Word macro to search for one mail merge code and replace it with another? I have tried, but the merge code I replace reverts back to the original value. I create a Word macro and use CTRL + H, put the data in to search and replace for(The merge fields) and click replace. It replaces the data, but after I save and return to document the old merge code is still there. The following vba code is generated:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "F_400"
.Replacement.Text = "F_901"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
I am replacing merge field F_400 with merge field F_901.