Merging documents

B

BArry

I am trying to open a series of Word documents and then
merge them into one larger document.
Allis going well until I get to a document that as a
Header....this does not get merged into the one larger
document.

The process I am using is:
objDoc = Documents.Open(FileName:=strDocumentName, _
ReadOnly:=False, _
PasswordDocument:="xxx", _
WritePasswordDocument:="xxx")
objWordApp.Selection.WholeStory ' *** this is not getting
the Header
objWordApp.Selection.Copy
objWordDoc.ActiveWindow.Activate ' activate new
document
objWordApp.Selection.MoveDown Unit:=wdScreen,
Count:=2
objWordApp.Selection.InsertBreak Type:=wdPageBreak
objWordApp.Selection.Paste

Can anyone please help me?

Thanks,
Barry
 
C

Caroline Miller

Instead of using code to open, copy content then paste
why don't you use code to insert the file into
destination document.

Also use next page section breaks instead of page breaks
to separate the documents.

This should work providing the docs are not a mix of same
and different first page header/footer.

Hope helps
Caroline
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top