Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word automation - replacing text
Message
De
13/10/2009 07:12:43
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
13/10/2009 00:17:59
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01429077
Message ID:
01429101
Vues:
54
>>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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform