5

I have about ~50 .doc files, that look perfect (they are extracted with Able2Extract). Now I want to join these 50 files into one huge .doc. I've tried using Word's in-built "Insert" feature, but that messed up the whole format. I want to keep everything I have. Like just document1 -> document2 -> document3.

Nothing "intelligent" or "smart" needed during the conversion, just the capability of joining them. (Thus making them all searchable, that's the ultimate aim.) I don't mind if the method/solution applies a single blank page at every document end either.

Apache
  • 16,299

2 Answers2

2

Do the documents have to be in a .doc after you're done building them? You might try combining them into a large .pdf with Adobe Acrobat or something similar. That would achieve your goal of having all the documents together in a searchable format, while preserving the formatting/layout of each one individually.

Darth Android
  • 38,658
0

The best way to join the documents while retaining original formatting is to use VBA and automate the steps you would do to join the documents manually. You will need to keep a few things in mind to make sure the formatting stays the same:

  • Ensure each document is separated by a new section
  • Ensure each document is imported using Keep source formatting.

The following VBA macro should help automate the process while keeping the above in mind. I havn't tested it first so I apologise if there are any bugs.

Sub CombineAll(sPath As String) 
    Dim baseDoc As Document, sFile As String 
    Set baseDoc = Application.Documents.Open(sPath & "BaseDoc.doc") 

    sFile = Dir(sPath & "*.doc") 
     'Loop through all .doc files in that path
    Do While sFile <> "" 

       Set sourceDoc = Application.Documents.Open(sPath & sFile) 
       Application.Selection.WholeStory
       Application.Selection.Copy
       Application.ActiveWindow.Close savechanges:=wdDoNotSaveChanges
       baseDoc.Activate

       Application.Selection.PasteAndFormat (wdFormatOriginalFormattig)
       baseDoc.InsertBreak Type:=wdSectionBreakNextPage
       sFile = Dir 
    Loop 
End Sub 
Adam
  • 7,669