Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word automation find/replace problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00799035
Message ID:
00799060
Vues:
26
Marvin,

I do not have any problem with your code. May be there is something special in your document? Send it to me if you wish.

>I'm working on a word automation project. Find and replace seems to work for when replacing with simple string. But my replacement text has several lines of infomation separated with carriage returns.
>
>I get the error OLE IDispatch exception code 0 from Microsoft Word: 'Text' is not a by reference property...
>
>The code is simple
>
>
WITH oRange.Find
>	.text = '[specialprices]'
>	.matchcase = .f.
>	.format = .f.
>	.replacement.font.name = 'Courier New'
>	.replacement.font.size = 9
>	.replacement.paragraphFormat.leftindent = 36
> 	.replacement.text = lSpecialPrices
>	lfound = .Execute(,,,,,,,,,,2)		&& Run and Replace All
>ENDWITH
>
>If lSpecialPrices = 'Run Spot Run' it works fine, but if lSpecialPrices looks like 'TEXT TEXT'+CHR(13)+'TEXT TEXT'+CHR(13)+'TEXT TEXT' then I get the OLE error above.
>
>Is there a good way around this? Thanks!!!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform