Office > Word > Word 2019 > Content

How to merge multiple word documents and split a word document into multiple files by style and page

Lionsure 2021-03-05 Original by the website

You can use the method of inserting files to merge multiple files into one file in Word. You only need to insert all the documents to be merged into one document at a time and save it.

A Word document can also be split into multiple, there are two ways, one is to split by title styles, the other is to split by macro (VBA). To split by title style, you need to set a title style at the split point, and then enter the outline view to split. You can split a document using Macro by page, that is, each page is split into a document, and it can also be split by section break or specified number of pages.


I. How to merge multiple word documents

Open a Word document to be merged, position the cursor behind the text on the last page, select the Insert tab, click the Down Arrow to the right of Object, select Text from File in the pop-up menu, and open the Insert File window, locate the folder where the documents to be merged are located, and use the mouse to select all the documents to be merged except the open documents (if they are connected together, after selecting the first one, hold down the Shift on the keyboard and click the last one to select them; if they are not consecutive, after selecting one, hold down the Ctrl on your keyboard and click one by one), click Insert, then the selected documents will be added to the first document in turn, press Ctrl + S on the keyboard to save. The demonstration is shown in Figure 1:

How to merge multiple word documents

Figure 1



II. How to split a Word document into multiple

If you want to split the Three and Four parts of the document into separate documents. Select the title of the Three part, hold down Ctrl on the keyboard, and then select the title of the Four part, click Heading 1 in the Styles group in the Home tab to set the style for them. Select the View tab, click Outline to enter the outline view, click the small plus icon before Three, hold down Shift on your keyboard, and then click the small plus icon before Four to select them. Click Show Documents in the Outline Tools group, and then click Create in the Maste Document group, then the Three and Four two parts will be created as separate documents, and press Ctrl + S on the keyboard to save. Click Close Outline View to exit the outline view. The demonstration is shown in Figure 2:

How to split a Word document into multiple

Figure 2

Tip: To split that part into a separate document, just apply a heading style to its title, and then select the content to be split in the outline view to split them.



III, Split word document into multiple documents by page

Use Microsoft Word to open the document to be split, press Alt + F11 on the keyboard to open the macro code editing window, click Insert, select Module in the pop-up menu, create a new module, and copy the following code:

Option Explicit

Sub SplitPageAsADocument()

       Dim i As Integer

       Dim srcDoc As Document, newDoc As Document

       Dim srcDocName As String, newDocName As String

       Dim objRange As Range

       Dim fso As Object

       Set fso = CreateObject("Scripting.FileSystemObject") 'Create a file object

       Set srcDoc = ActiveDocument

       Set objRange = srcDoc.Content

       objRange.Collapse wdCollapseStart


       For i = 1 To ActiveDocument.Content.Information(wdNumberOfPagesInDocument)



              Application.Browser.Target = wdBrowsePage


              srcDocName = srcDoc.FullName

              newDocName = fso.BuildPath(fso.GetParentFolderName(srcDocName), _
fso.GetBaseName(srcDocName) & _ & i & . & fso.GetExtensionName(srcDocName)) 'Generate a new document name

              Set newDoc = Documents.Add 'Create a new document


              newDoc.SaveAs newDocName

              newDoc.Close False


       Set newDoc = Nothing

       Set objRange = Nothing

       Set srcDoc = Nothing

       Set fso = Nothing

       MsgBox "Finish."

End Sub

to the created module window, click Run, select Run Macro (or press F5 on the keyboard ) in the pop-up menu to execute the code, after a while, the split is complete, and the split document is saved in the folder containing the original document.