WITH loWord.oWord.Selection.Find
...
.Text = "[Anschrift1]"
.Replacement.Text = ALLTRIM(Anschrift1)
.Execute(wdReplaceAll)
ENDWITH
loWord is a reference to a class that does some help with Word automation; the oWord object allows me to access the Word object model.
The idea is to have standard texts as "markers" where variable texts should be replaced.
Before executing the .Execute(wdReplaceAll), that actually does the replacing, .Text has the specified value. Why would this jump to the value 2 (which happens to be the value of constant wdReplaceAll) as soon as the .Execute(...) is executed? Also, the results indicate that this is what has been replaced. The text "2" was replaced with the replacement text.Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)