Merging Multiple documents having different headers and footers ma

S

Srikanth

Dear All,

I am trying to merge a several word/rtf documents into a single word
documents with the below macro, the problem is now each document is having a
different header and footer and some fields,
Can anyone suggest me a macro code for merging multiple word documents into
a single document without disturbing the headers and footers of each document?

Sub MergeDocs()
Dim rng As Range
Dim MainDoc As Document
Dim strFile As String
Const strFolder = "c:\tes\" 'change to suit
Set MainDoc = Documents.Add
strFile = Dir$(strFolder & "*.doc") ' can change to .docx
Do Until strFile = ""
Set rng = MainDoc.Range
rng.Collapse wdCollapseEnd
rng.InsertFile strFolder & strFile
strFile = Dir$()
Loop
End Sub

Thanks in advance.
 

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