How to create continuous page numbers across multiple Word documents

If you need to create reports, documents, or even lengthy essays, there is no better platform than Microsoft Word. The program offers various tools and features to help improve the quality of your content and the structure of your final document. One such feature available in Microsoft Word is the ability to add page numbers in the header or footer of your document. However, some users want to know how they can add continuous page numbers across multiple Word documents. So please continue reading to learn how.

Method 1: Use Excel and Visual Basic to create a macro. The macro will iterate across your files, setting the starting page numbers to correspond to the proper files:

  • Firstly, open your Word document.
  • Click on “Insert.”
  • After that, click on “Break” followed by “Section Break (Continuous).”
  • Double tap on the footer section to open it.
  • Click on (Control/Command + F9 or fn + F9) keys.
  • Type “PAGE” inside the braces.
  • Save the Word document.
  • Keep a copy of the file directory path.
  • Open Microsoft Excel.
  • Click on “Developer.”
  • Open Visual basic by clicking on the “Visual Basic” icon.
  • Open a VBA project sheet.
  • Input this code.
  • Now click on the “Save” icon followed by “Save.”
  • Click on the “Run” icon to run the script and complete the process.

Method 2: Use master and subdocuments to pull your files into a single document:

  • Create a new document in Word to act as a master document.
  • Click on “View” in the top menu.
  • Click on “Outline.”
  • Next, click on “Show Document.”
  • Then click on “Insert” to add your documents into the master document.

You must enter the document file names into the fileNames array together with the directory where the documents are kept to utilize the macro. The macro instructs the first document to begin on page 1 and the following documents to begin one page above the prior document’s highest page number. You must restart the macro if you modify the number of pages in any document.

You might reconsider your document structure and merge all the various documents into one document if you don’t want to utilize fields or macros to handle the page numbering. Another option is to completely abandon Word and create your page layout in a desktop publishing application like InDesign, which is designed to support multiple-file page numbering. However, many users may not find those options feasible; therefore, the option shown here is the only one that will work well for them.

Method 1: Use Excel and Visual Basic to create continuous page numbers across multiple Word documents

If you need more help with the steps, you can use our in-depth guide to help. The in-depth guide includes resources, such as screenshots and an in-depth analysis of the more complex steps in the process. I recommend that you go through the in-depth guide so you have a better understanding of how to complete the process.

  • Firstly, open your Word document.

I have a plain document; however, if you have preexisting content, you don’t have to worry; the process will work fine. The guide here will only work on the Microsoft desktop version; if you use the browser version, please download the application and open the programs through the desktop.

  • Click on “Insert.”

You will need to first set the parameters for the document for when you run the VBA; there will be no issue in sourcing the correct data sets to input page number sequences across all your documents.

  • After that, click on “Break” followed by “Section Break (Continuous.).”

A section ensures that a break is detected along the page section, generally where the footer is; however, it can be different, especially if you have multiple fields in the header or footer. Make sure you have no fields when you begin the process; the Macro will automatically generate the required fields through the braces we will add.

  • Double tap on the footer section to open it.

Click on the footer section twice, and you can make edits within this section; as illustrated earlier, ensure you don’t create any filed columns.

  • Click on (Control/Command + F9 or fn + F9) keys.

This will enable a command brace set that works actively with Excel Macros to insert a page break number sequence in the footer.

  • In the braces, input the word “PAGE.”

Add the word “PAGE” in the footer, all in capitals between the braces. This is an active pin that Excel will use to input the page number sequence.

  • Save the Word document.
  • Keep a copy of the file directory path.
  • Open Microsoft Excel.
  • Click on “Developer.”
  • Open Visual basic by clicking on the “Visual Basic” icon.
  • Open a VBA project sheet.
  • Input the following.
Sub PageNumberReset()
    Dim pgNo As Long
    Dim n As Long
    Dim pathName As String
    Dim fileNames
    Dim thisFile As String
    Dim aRange As Range

    ' Specify the path to the document files
    pathName = "C:\MyDocs\Example\"
    ' Create an array holding the document file names, in sequence
    fileNames = Array("Chap1.docx", "Chap2.docx", "Chap3.docx")

    pgNo = 0
    For n = 0 To UBound(fileNames)
        thisFile = pathName & fileNames(n)
        Application.Documents.Open (thisFile)
        ActiveDocument.Sections(1).Headers(1).PageNumbers.StartingNumber = pgNo + 1
        Set aRange = ActiveDocument.Range
        aRange.Collapse Direction:=wdCollapseEnd
        aRange.Select
        pgNo = Selection.Information(wdActiveEndAdjustedPageNumber)
        Application.Documents(thisFile).Close Savechanges:=wdSaveChanges
    Next n
End Sub

To use the macro, supply the fileNames where the documents are kept and the names of the document files.

  • Now click on the “Save” icon followed by “Save.”
  • Click on the “Run” icon to run the script and complete the process.

You will be able to achieve your goal of having continuous page numbering across numerous documents if you have more than one. You will need to manually alter the page numbering in the following documents if one document has extra or fewer pages. Master papers and subdocuments can be used; however, significant problems might stop the process from operating. This guide will help you create continuous page numbers across multiple documents.

Remember that you must have the directory where the documents are stored and the document file names, which you must supply into the fileNames array to use the macro.

Method 2: Use subdocuments to create continuous page numbers across multiple Word documents

If you don’t have access to Microsoft Excel, you can use master and subdocuments to create continuous pages across all your Word documents. First, create a new Word document, then follow the steps below.

  • In Word, go to “View” and then “Outline.”
  • Then click on “Show Document.”
  • There, you can “Insert” subdocuments into a master document.

The page numbers of each subdocument will change depending on the order in which you insert them into the master document.

Conclusion

Thank you for reading our content on creating continuous page numbers across multiple Word documents. I have provided the steps to do this by using Macros in Excel and an in-depth guide. The VBA editor is great to help run tasks external to the program; you can also manage file names and bulk edit preexisting data sets for content within folders. The in-depth guide includes some resources that you will want to navigate through. If you need more help, drop a comment below, and we will address your issues.

Saajid Gangat

Saajid Gangat has been a researcher and content writer at Business Tech Planet since 2021. Saajid is a tech-savvy writer with expertise in web and graphic design and has extensive knowledge of Microsoft 365, Adobe, Shopify, WordPress, Wix, Squarespace, and more! You can connect with Saajid on Linkedin.

Recent Posts