Merging Multiple documents having different headers and footers ma

  • Follow


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.
2
Reply Utf 12/9/2009 9:07:01 AM


0 Replies
429 Views

(page loaded in 0.012 seconds)

Similiar Articles:
















7/22/2012 1:11:51 PM


Reply: