Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word automation - replacing text
Message
From
12/10/2009 21:26:14
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Word automation - replacing text
Miscellaneous
Thread ID:
01429077
Message ID:
01429077
Views:
100
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.
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)
Next
Reply
Map
View

Click here to load this message in the networking platform