How to split a Word document into separate files every 5 or n pages?
When working with large Word documents, you may need to split the document into smaller, separate files for easier handling, sharing, or editing. Splitting a document every 5 or 10 or a specified number of pages can be a practical solution for managing lengthy content more efficiently.
Manually copying and pasting pages one by one is time-consuming and inefficient. In this tutorial, we will introduce quick and easy methods to split a Word document into separate files every N pages:
Split a Word document into separate files every N pages with VBA code
Split a Word document into separate files every N pages with an amazing feature
Split a Word document into separate files every N pages with VBA code
To split a large document into separate files based on every N pages, the following VBA code can assist you. Follow these steps:
- Hold down ALT + F11 to open the Microsoft Visual Basic for Applications window.
- Click Insert > Module, and copy and paste the following code into the blank module:
- After pasting the code, still in the Microsoft Visual Basic for Applications window, click Tools > References. In the References - Project dialog box, check the Microsoft VBScript Regular Expressions 5.5 option from the Available References list. See screenshots:
- Click OK, then press F5 to run the code.
- A Browse For Folder dialog box will appear. Select the folder where you want to save the split files, and click OK.
- Another prompt will appear asking for the number of pages you want to split by. Enter the desired page count and click OK.
- The document will be split into separate files every N pages. Navigate to the specified folder to view the results.
Sub DocumentSplitter()
Dim xDoc As Document, xNewDoc As Document
Dim xSplit As String, xCount As Long, xLast As Long
Dim xRngSplit As Range, xDocName As String, xFileExt As String
Dim xRegEx As RegExp
Dim xPageCount As Integer
Dim xShell As Object, xFolder As Object, xFolderItem As Object
Dim xFilePath As String
On Error Resume Next
Set xDoc = Application.ActiveDocument
Set xShell = CreateObject("Shell.Application")
Set xFolder = xShell.BrowseforFolder(0, "Select a Folder:", 0, 0)
If TypeName(xFolder) = "Nothing" Then Exit Sub
Set xFolderItem = xFolder.Self
xFilePath = xFolderItem.Path & "\"
Application.ScreenUpdating = False
Set xNewDoc = Documents.Add(Visible:=False)
xDoc.Content.WholeStory
xDoc.Content.Copy
xNewDoc.Content.PasteAndFormat wdFormatOriginalFormatting
With xNewDoc
xPageCount = .ActiveWindow.Panes(1).Pages.Count
L1: xSplit = InputBox("The document contains " & xPageCount & " pages." & _
vbCrLf & vbCrLf & "Please enter the number of pages per split:", "Kutools for Word", xSplit)
If Len(Trim(xSplit)) = 0 Then Exit Sub
Set xRegEx = New RegExp
With xRegEx
.MultiLine = False
.Global = True
.IgnoreCase = True
.Pattern = "[^0-9]"
End With
If xRegEx.Test(xSplit) = True Then
MsgBox "Please enter a valid page number:", vbInformation, "Kutools for Word"
Exit Sub
End If
If VBA.Int(xSplit) >= xPageCount Then
MsgBox "The entered number exceeds the total page count of the document." & vbCrLf & "Please enter a valid number.", vbInformation, "Kutools for Word"
GoTo L1
End If
xDocName = xDoc. Name
xFileExt = VBA.Right(xDocName, Len(xDocName) - InStrRev(xDocName, ".") + 1)
xDocName = Left(xDocName, InStrRev(xDocName, ".") - 1) & "_"
xFilePath = xFilePath & xDocName
For xCount = 0 To Int(xPageCount / xSplit)
xPageCount = .ActiveWindow.Panes(1).Pages.Count
If xPageCount > xSplit Then
xLast = xSplit
Else
xLast = xPageCount
End If
Set xRngSplit = .GoTo(What:=wdGoToPage, Name:=xLast)
Set xRngSplit = xRngSplit.GoTo(What:=wdGoToBookmark, Name:="\page")
xRngSplit.Start = .Range.Start
xRngSplit.Cut
Documents.Add
Selection.Paste
ActiveDocument.SaveAs FileName:=xFilePath & xCount + 1 & xFileExt, AddToRecentFiles:=False
ActiveWindow.Close
Next xCount
Set xRngSplit = Nothing
xNewDoc.Close wdDoNotSaveChanges
Set xNewDoc = Nothing
End With
Application.ScreenUpdating = True
End Sub
Split a Word document into separate files every N pages with an amazing feature
Kutools for Word provides a powerful Split function that enables you to quickly split a large Word document into multiple separate files based on Heading 1, page breaks, section breaks, or pages. This feature streamlines what would otherwise be a tedious manual process.
- Click Kutools Plus > Split.
- In the dialog box that appears, configure the following options as needed:
- Select the Every n pages option from the Split by menu.
- Specify the n value in the input box.
- Choose a saving location.
- Specify a prefix for the split documents.
- After completing the settings, click OK. The document will be split into multiple files based on the selected option (e.g., every 7 pages).
Using the Split feature in Kutools for Word makes dividing large documents into smaller, manageable files both simple and efficient.
Best Office Productivity Tools
Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!
π€ Kutools AI Features: AI Assistant / Real-Time Assistant / Super Polish (Preserve Format) / Super Translate (Preserve Format) / AI Redaction / AI Proofread...
π Document Mastery: Split Pages / Merge Documents / Export Selection in Various Formats (PDF/TXT/DOC/HTML...) / Batch Convert to PDF...
β Contents Editing: Batch Find and Replace across Multiple Files / Resize All Pictures / Transpose Table Rows and Columns / Convert Table to Text...
π§Ή Effortless Clean: Sweap away Extra Spaces / Section Breaks / Text Boxes / Hyperlinks / For more removing tools, head to the Remove group...
β Creative Inserts: Insert Thousand Separators / Check Boxes / Radio Buttons / QR Code / Barcode / Multiple Pictures / Discover more in the Insert group...
π Precision Selections: Pinpoint Specific Pages / Tables / Shapes / Heading Paragraphs / Enhance navigation with more Select features...
β Star Enhancements: Navigate to Any Location / Auto-Insert Repetitive Text / Toggle Between Document Windows / 11 Conversion Tools...
π Supports 40+ Languages: Use Kutools in your preferred language β supports English, Spanish, German, French, Chinese, and 40+ others!

Best Office Productivity Tools
Kutools for Word - 100+ Tools for Word
- π€ Kutools AI Features: AI Assistant / Real-Time Assistant / Super Polish / Super Translate / AI Redaction / AI Proofread
- π Document Mastery: Split Pages / Merge Documents / Batch Convert to PDF
- β Contents Editing: Batch Find and Replace / Resize All Pictures
- π§Ή Effortless Clean: Remove Extra Spaces / Remove Section Breaks
- β Creative Inserts: Insert Thousand Separators / Insert Check Boxes / Create QR Codes
- π Supports 40+ Languages: Kutools speaks your language β 40+ languages supported!