Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combining two Word documents - How?
Message
From
30/01/2002 10:42:36
 
 
To
30/01/2002 09:01:10
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00612320
Message ID:
00612739
Views:
29
Tamar:

Please see my post in VFP7 - More Automtation Woes with VFP7 SP1 :(


>>>Try this:
>>>*---------------------
>>>lcfile1="c:\encrypting.doc"
>>>lcfile2="c:\If Operating Systems were beers.doc"
>>>wdStory=6
>>>wdSectionBreakNextPage=2
>>>
>>>oWord = CREATEOBJECT("word.application")
>>>with oWord
>>> .Documents.open(lcfile1)
>>> .Selection.EndKey(wdStory)
>>> .Selection.InsertBreak(wdSectionBreakNextPage)
>>> .Selection.InsertFile(lcfile2,"", .f.,.f.,.f.)
>>>endwith
>
>You should be able to speed this up a little by using the Range object instead of the Selection object. (In general, you should use Range wherever possible rather than Selection.)
>
>WITH oWord
> .Documents.Open(lcFile1)
> oRange = .ActiveDocument.Range()
>ENDWITH
>
>WITH oRange
> .Collapse(wdCollapseEnd)
> .InsertBreak( wdSectionBreakNextPage )
> .Collapse(wdCollapseEnd)
> .InsertFile(lcFile2, "", .f., .f., .f.)
>ENDWITH
>
>Warning: untested code, just a translation of Yuri's code.
>
>Tamar
-=Gary
Previous
Reply
Map
View

Click here to load this message in the networking platform