>>In the Visual FoxPro code, I have:
>>
>>
>>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.
>
>This might be too obvious, but are you missing some quotes i.e.
>
> .Replacement.Text = ALLTRIM("Anschrift1")
>
No; Anschrift1 (address) is the field name. Çetin gave the solution - the first parameter is the text to be searched. I had assumed I could use the first named parameter as the first parameter.
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)