Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combining two Word documents - How?
Message
 
To
29/01/2002 17:02:12
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00612320
Message ID:
00612591
Views:
29
I was not able to find a stright solution. However you could just replace header/footer in the sections belonging to different documents:

oWord = CREATEOBJECT("Word.Application")
lcfile1="c:\_1.doc"
lcfile2="c:\_2.doc"

oWord.documents.open(lcfile1)

wdStory=6
wdSectionBreakNextPage=2
wdHeaderFooterPrimary=1

with oWord
.Selection.EndKey(wdStory)
.Selection.InsertBreak(wdSectionBreakNextPage)
.Selection.InsertFile(lcfile2)

with .ActiveDocument.Sections(1)
.Headers(wdHeaderFooterPrimary).Range.Text = "Header text for Section1"
.Footers(wdHeaderFooterPrimary).Range.Text = "Footer text for Section1"
endwith
with .ActiveDocument.Sections(2)
.Headers(wdHeaderFooterPrimary).Range.Text = "2 Header text"
.Footers(wdHeaderFooterPrimary).Range.Text = "2 Footer text"
endwith

endwith
......


At least it is a solution, though not elegant.


>Yuri:
>
>>I will let you know if succeed.
>
>Thank you so much.
>
>-Gary
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform