Yuri, in troubleshooting my code I figured out the problem. It looks like the replace string max is 256 characters or so. But I'm usually dumping much more than that. So I guess I'll have to find another way to insert a large paragraph at that point. Any ideas? Thanks!
>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)
>>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!!!