How to split document into multiple documents in word?

If you have a massive word document which you need to split into multiple documents, take a few minutes to read this tutorial. This tutorial will show you two methods for splitting a document into multiple documents.

Split document into multiple documents with VBA

Split document into multiple documents by using Kutools for Word

Kutools for Word: Add 100 New Advanced Features to Word 2003/2007/2010/2013/2016.
Office Tab: Enable Tabbed Editing and Browsing in Office, Just Like Chrome, Firefox, IE 8/9/10.
Classic Menu for Office: Bring Old Look of Office 2003 Back to Office 2007, 2010, 2013 and 2016.

arrow blue right bubble Split document into multiple documents with VBA

Hot
Amazing! Using Tabs in Word like Firefox, Chrome, Internet Explore 10!

Learn more Free download

Instead of splitting document into multiple documents manually, we can split document into multiple documents with VBA.

Step 1: Press “Alt-F11” to open the Microsoft Visual Basic for Application window;

Step 2: Click Module on the Insert tab, copy and paste the following VBA code into the Module window;

Step 3: Then click Run doc-remove-numeric-characters-1 button to apply the VBA.

VBA Code: split document into multiple documents according to delimiter:

Sub SplitNotes(delim As String, strFilename As String)
Dim doc As Document
Dim arrNotes
Dim I As Long
Dim X As Long
Dim Response As Integer
arrNotes = Split(ActiveDocument.Range, delim)
Response = MsgBox("This will split the document into " & UBound(arrNotes) + 1 & " sections.Do you wish to proceed?", 4)
If Response = 7 Then Exit Sub
For I = LBound(arrNotes) To UBound(arrNotes)
If Trim(arrNotes(I)) <> "" Then
X = X + 1
Set doc = Documents.Add
doc.Range = arrNotes(I)
doc.SaveAs ThisDocument.Path & "\" & strFilename & Format(X, "000")
doc.Close True
End If
Next I
End Sub
Sub test()
'delimiter & filename
SplitNotes "///", "Notes "
End Sub

Note:

1. Be sure to add your delimiter as the same as "///" in the sub test to the document between each section of text you wish to separate. Also, you can change "///" to any delimiters to meet your need.

2. You can change the documents "Notes "in the sub Test to suit your needs.

3. And the splitting documents will be saved to the same place with the original file.

4. You do not need to add delimiter to the end of the original file, if you do, there will be a blank document after splitting.

This is VBA for Splitting document into multiple single-paged document

Sub SplitIntoPages()
Dim docMultiple As Document
Dim docSingle As Document
Dim rngPage As Range
Dim iCurrentPage As Integer
Dim iPageCount As Integer
Dim strNewFileName As String
Application.ScreenUpdating = False 'Makes the code run faster and reduces screen _
flicker a bit.
Set docMultiple = ActiveDocument 'Work on the active document _
(the one currently containing the Selection)
Set rngPage = docMultiple.Range 'instantiate the range object
iCurrentPage = 1
'get the document's page count
iPageCount = docMultiple.Content.ComputeStatistics(wdStatisticPages)
Do Until iCurrentPage > iPageCount
If iCurrentPage = iPageCount Then
rngPage.End = ActiveDocument.Range.End 'last page (there won't be a next page)
Else
'Find the beginning of the next page
'Must use the Selection object. The Range.Goto method will not work on a page
Selection.GoTo wdGoToPage, wdGoToAbsolute, iCurrentPage + 1
'Set the end of the range to the point between the pages
rngPage.End = Selection.Start
End If
rngPage.Copy 'copy the page into the Windows clipboard
Set docSingle = Documents.Add 'create a new document
docSingle.Range.Paste 'paste the clipboard contents to the new document
'remove any manual page break to prevent a second blank
docSingle.Range.Find.Execute Findtext:="^m", ReplaceWith:=""
'build a new sequentially-numbered file name based on the original multi-paged file name and path
strNewFileName = Replace(docMultiple.FullName, ".doc", "_" & Right$("000" & iCurrentPage, 4) & ".doc")
docSingle.SaveAs strNewFileName 'save the new single-paged document
iCurrentPage = iCurrentPage + 1 'move to the next page
docSingle.Close 'close the new document
rngPage.Collapse wdCollapseEnd 'go to the next page
Loop 'go to the top of the do loop
Application.ScreenUpdating = True 'restore the screen updating
'Destroy the objects.
Set docMultiple = Nothing
Set docSingle = Nothing
Set rngPage = Nothing
End Sub

Note: The splitting documents will be saved to the same place with the original file.

For more information about these codes, visit:

http://www.vbaexpress.com/kb/getarticle.php?kb_id=922 and http://www.vbaexpress.com/kb/getarticle.php?kb_id=727


arrow blue right bubble Split document into multiple documents with Kutool for Word

If you are not familiar with macro, it is very complicated to split document into multiple document by using VBA, but with Kutools for WordSplit function, you can easily split document into multiple documents.

Kutools for Word, a handy add-in, includes groups of tools to ease your work and enhance your ability of processing word document. Free Trial for 45 days! Get It Now!

Please apply the utility by clicking Enterprise > Split. See screenshot:

Step 1: Click Enterprise > Split, there will be a popup dialog in the screen. See screenshot:

You can see the results as show as below:

Note: You also can split the file to multiple documents by headings (before split by headings, you should add headings by clicking Home tab, and select one type of headings  to the file first), section break and page break (add section break and page break by clicking Page Layout > Breaks to file first).

For more detailed information about Split Document of Kutools for Word, please visit: Split Document feature description.


Relative articles:


 

arrow blue right bubble Kutools for Word

More than 100 Advanced Functions for Word 2003, 2007, 2010, 2013 and 2016

shot-kutools-700-225-kte

More Features | Free Download | Only $39.00 for hundreds of functions

Comments  

Permalink +5 Dhamo
When i try to split document the word document by using the above VB code, Its splitting by removing all the images and inseterd objects.
2014-08-21 15:21 Reply Reply with quote Quote
Permalink +1 Tom Saylor
I'm having a problem similar to Dhamo's. I started with a large file with many embedded content controls. When I split my Word file using the VB code, the content controls were all converted to regular text. Is there any way to split a file without losing the formatting of the original?
2016-09-10 16:33 Reply Reply with quote Quote
Permalink 0 Ilya
Hello. How I can split .doc not one page per document using these scripts? E.g. 10 or 5 pages per document
2015-08-26 08:34 Reply Reply with quote Quote
Permalink +1 Kotieddy
Dear team,
VBA for Splitting document into multiple single-paged document is working good, but the problem is split documents are not having the table formats.(table formats in master document are not formatted as table in split documents).
Thanks in advance if i can get the macros, so that tabular formats in master document are not disturbed in split documents
2016-01-11 03:11 Reply Reply with quote Quote
Permalink 0 Diane
Very helpful thank you!

My original document had 'read only' set. This is not transferring into the new documents. Is this possible to add?
2016-03-18 13:58 Reply Reply with quote Quote
Permalink 0 JP
Unfortunately, I can't split pages with Kutools. What can I do? I get this error message:

Informationen über das Aufrufen von JIT-Debuggen
anstelle dieses Dialogfelds finden Sie am Ende dieser Meldung.

************** Ausnahmetext **************
System.NotSupportedException: Das angegebene Pfadformat wird nicht unterstützt.
bei System.Security .Util.StringExp ressionSet.Cano nicalizePath(St ring path, Boolean needFullPath)
bei System.Security .Util.StringExp ressionSet.Crea teListFromExpre ssions(String[] str, Boolean needFullPath)
bei System.Security .Permissions.Fi leIOPermission. AddPathList(Fil eIOPermissionAc cess access, AccessControlAc tions control, String[] pathListOrig, Boolean checkForDuplica tes, Boolean needFullPath, Boolean copyPathList)
bei System.Security .Permissions.Fi leIOPermission. .ctor(FileIOPer missionAccess access, String[] pathList, Boolean checkForDuplica tes, Boolean needFullPath)
bei System.IO.Direc tory.InternalCr eateDirectoryHe lper(String path, Boolean checkHost)
bei System.IO.Direc tory.CreateDire ctory(String path)
bei Kutools.FormDoc umentSplit.€()
bei Kutools.FormDoc umentSplit.›(O bject “, EventArgs ”)
bei System.Windows. Forms.Control.O nClick(EventArg s e)
bei System.Windows. Forms.Button.On Click(EventArgs e)
bei System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
bei System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons button, Int32 clicks)
bei System.Windows. Forms.Control.W ndProc(Message& m)
bei System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
bei System.Windows. Forms.Button.Wn dProc(Message& m)
bei System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
bei System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
bei System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
2016-03-20 20:35 Reply Reply with quote Quote
Permalink 0 David Fuller
Too hard for a pensioner to comprehend what happened to the old way I windows seven that program was so easy for us older people to follow.
2016-10-10 07:25 Reply Reply with quote Quote
Permalink 0 Phil Smith
Your macro works REALLY well, however, I require the split documents to retain their narrow margins and two coluimn layout. More by luck than judgement(!), I managed to achieve this manually and the end result was exactly as I required. I then used the macro recorder but do not have the knowledge of Word VBA to alter the recorded code to achieve this. Can you help? Thanks in advance!
2016-12-16 11:59 Reply Reply with quote Quote
Permalink 0 Geo. Kelley
I tried the first split document code and it did not work. It said it was breaking it into three sections, but it did not.
2017-02-21 19:44 Reply Reply with quote Quote
Permalink 0 Geo. Kelley
Forget it, I tried several times with the letters numbers, which did not work, then I seen it erased my comments.

Just to note the first code did not work for me, it said it was breaking the document into three sections, but did not.
2017-02-21 19:48 Reply Reply with quote Quote
Permalink 0 Panos HalfMan
Does anyone knows how to change the name of the files after splitting the main one

I want to change the names according to Header of the file
2017-03-21 12:39 Reply Reply with quote Quote
Permalink 0 LK
I did the VBA Code: split document into multiple documents according to delimiter, it does split the document but unfortunately the graphics are deleted, also formatting. Is there a solution to this?
2017-03-24 15:08 Reply Reply with quote Quote
Permalink 0 Ramin
Thanks for the macro code
2017-05-20 06:10 Reply Reply with quote Quote
Permalink 0 Prince
Thank you, this was very helpful!
2017-05-23 12:16 Reply Reply with quote Quote

Add comment


Security code
Refresh