Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error with automation code vfp -> word

Status
Not open for further replies.

poeijer

Programmer
May 29, 2002
69
NL
idea is to copy the content of poTemplateDoc to poWerkDoc.
using copy/paste. i use therefor the code below.

-------------------------------------
poTemplateDoc.content.range().copy
poWerkDoc.content.range().paste
-------------------------------------

when executing the above code I get the error:
Member RANGE does not evaluate to an object.

anyone got an idea? thanks.
 
poeijer

This works for me:
Code:
cWordTemplate = GETFILE("dot","Get letter template","Use")
IF !EMPTY(cWordTemplate)
    oWord = CREATEOBJECT("word.application")
    oWord.Documents.OPEN(cWordTemplate)
    loTemplate=oWord.SELECTION
    loTemplate.WholeStory
    loTemplate.COPY
    loDocument=oWord.Documents.ADD()
    loSelection = oWord.SELECTION
    loSelection.Paste
ENDIF

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
thanks, i also managed to rewrite it with a simpler way.

poTemplateDoc.content.range().copy
poWerkDoc.content.range().paste

------>

range1 = poTemplateDoc.range()
range1.copy
range2 = poWerkDoc.range()
range2.paste

---------

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top