Resting Anchor

The Anchorage

Personal website of Gregory K. Maxey, Commander USN (Retired)

Document Splitter
(A Microsoft Word Help & Tip page by Gregory K. Maxey)

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

The purpose of this Microsoft Word Help & Microsoft Word Tips page is to publish and provide an add-in that you can use to conveniently split a active document into one or more individual documents based on the selected delimiter. The user can split the document into parts defined by section breaks, pages, heading 1 style, or a user defined delimiter.

This can be useful for saving mail merged letters as individual files, or saving a complete manuscript as individual files where each file contains one chapter, etc.

Site Note IconBonus Tip: A more specific process for saving mail merge letters to individual documents can be downloaded from Word MVP Graham Mayor's Downloadable Files.  Download the file named MMtoDocs.zip.

The add-in uses a Userform as the UI. The UI lets the user define the delimiter, path, and file name prefix for the individual files. The add-in automatically assigns a sequential number suffix to each file created.

The UI when the add-in is first opened is illustrated below. The user chooses the delimiter and then clicks the "Pick Directory" button which then opens a dialog to select the file path.

doc splitter 1

The "User Defined" options allows the user to define there own text string as a delimiter. For example, a user may have a collection of notes divided by a string "********"

doc splitter 2

The "Pick Directory" command button uses the Office FileDialog object or a simple VBA input box depending on the Word version in use. If a dialog similar to the one shown below appears just click to select the desired directory. You don't have to type anything in the text field. In the example shown, the files will be saved in "My Documents."

Site Note IconNote: This dialog is available in Word versions 11.0 (Word2003) and above only. Earlier versions will use a simple inputbox for the user to input the file path.

doc splitter 3

After the user chooses the path, the file prefix textbox is enabled. In this textbox the user defines the prefix for the file name. Prefix characters are limited to the letters of the alphabet, numerals, and the characters "_,(, and )" only. When a valid file prefix is entered the Validate/Confirm Actions command button is enabled. This lets the user see and confirm the actions pending.

doc splitter 4

When the user presses OK the add-in creates and saves the individual files. If the selected delimiter is "Sections" or "Pages" the add-in will recreate the page layout of the source page in the new documents. No further user action is required.

The add-in is provided here in a zip file format: Document Splitter

Site Note icon For more on template add-ins and how to load them, see: Organizing Your Macros/Template Add-ins at: Installing Macros

That's it! I hope you have found this tips page useful and informative.

Share

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.

Click to acces PayPal Verification Service Click to acces PayPal Verification Service

However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!

Click to donate British Pound Sterling                   Click to donate US dollars                   Click to donate EU euros

Search my site or the web using Google Search Engine

Google Search Logo