Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combining two Word documents - How?
Message
De
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:
00612365
Vues:
22
Yuri:

Wow! Thanks! That is exactly what I wanted. I searched through the VBAWord.CHM that comes with Office but didn't see this - just adding a subdocument. This is so straightforward - thank you so much!

Just one other thing. The header section in document (b) (after it is inserted) is spot on - in the second document, I am getting the second header. However, the footer from the previous section (first document) is still showing at the bottom of the second document.

There should be no footer data in document (b) after it has been inserted at the end of document (a).

Any ideas how to stop this?

>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
>
>Best Wishes
>
>
>>How can I take Word document(a) and Word document (b) and put the contents of (B) at the end of the contents of (a) ?
>>
>>Document (b) has a different header to that in document (a), therefore, there needs to be a section break at the bottom of document (a) and document (b) is then in the new section observing its own header/footer.
>>
>>I tried to use the subdocuments collection of document (a) and the addfromfile method but, despite following all of the steps, no joy. I kept getting an OLE dispatch error that said the object was a table ? (the two documents are littered with Word tables)
>>
>>I need to do this and I am struggling for ideas. Any help much appreciated.
>>
>>Best
>>
>>-Gary
-=Gary
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform