Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combining two Word documents - How?
Message
De
30/01/2002 09:01:10
 
 
À
29/01/2002 14:29:57
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00612320
Message ID:
00612658
Vues:
35
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform