Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2021 by Barry MacDonnell. All Rights Reserved.

Page updated Apr 16, 2021

Splitter - A macro that splits the current document into two or more sequentially numbered files on your disk

Download SPLITTER.ZIP (v1.0; 05/28/10; 14,373 bytes)

Written in WordPerfect X5 but should be compatible with earlier versions.

WordPerfect 11 users: See important information about using macros in the first release of WP11 ( at the top of this page.

Downloading, Documentation, Modifications, and Support

See also Clipper - A macro that lets you select material in the current document (or any open WP document) and automatically clip (copy or move) it to a separate temporary document.


Splitter.wcm will split the current document into several new (and incrementally numbered) files on disk, such as:

001 MyNewDocument.wpd
002 MyNewDocument.wpd
999 MyNewDocument.wpd

The macro simply copies selections (delimited by text markers you added) from the current document and saves the selections in a series of new, sequentially numbered files in a specified storage folder.

(Note that if a numbered filename already exists in that storage folder, it will be overwritten. An optional message will pop up to alert the user to this situation, but it is better to move or rename these files before using the macro again.)

The position of the file's number — before or after the root filename — can be specified, as well as its padded size, beginning number, etc. (see below).

This macro might be useful as well in preparing to create subdocuments from a single file in preparation for using WordPerfect's Master/Subdocument feature. [Later, the subdocuments can be automatically added to the Master with a macro such MakeSubs]

If you just need to clip parts of any open document into a separate on screen document, see Clipper.


Download and extract the macro from the download file (◄- left sidebar), and place it in your default or supplemental macro folder. (See the "Downloading..." link in the left sidebar if you need help.)

Make a copy of your original document as a backup. Then -

[1.] Insert "separators" in the current document.

Place a WordPerfect symbol (with Ctrl+w) or any special character string not otherwise used in the current document (e.g., @#$%) at the end of every section you wish to save as a separate new file.

The default separator expected by the downloaded macro is a single heart symbol (i.e., symbol 5,0), but you can use any other symbol or symbols. (See also #4 below.)

Be sure to use the exact same symbol(s) as separators throughout the current document.

Be sure to include one separator at the very end of the current document if you wish the last section of the document to also be included as a file in the storage folder.

Basic operation:

•  The macro will start from the top of the document and select everything up to (but not including) the first separator.
•  It will then save that selection to a new file on disk (not on screen). •  It then skips over that separator and repeats the process, thereby splitting the current file into the desired sections, each in its own new file on disk.
•  The current file is not affected by the splitting process — although it retains the separator symbols — and if it is a copy of the original it can be discarded later.

Modify the macro. (A WordPerfect macro can be opened and saved like any other document.) Normally, this is a one-time procedure, and is easy to do.

[2.] Create a special storage folder on your computer to store the new files.

Use Windows File Explorer (or similar file manager) to create the new folder in any convenient location.

The folder can be named anything, but generally you will want to use a fairly short folder name.

[3.] Enter the full path to that storage folder at the top of the macro's redlined User Modification Area. Be sure to include the drive letter.

For example, the default used by the author is -


You can also change the root portion of the filenames — i.e., the part without the incrementing number — and/or filename extension (.wpd is the default) to use for the new files to be stored in that folder. (See the User Modification Area.)

[4.] Enter the same symbol(s) or character(s) (discussed in #1 above) in the macro's redlined User Modification Area — see the vSplitter variable there.

The macro uses the value stored in this variable to search for the same symbols or characters in the document itself.


Try to use a single symbol or character as the separator — although the macro should compensate for multiple symbols/characters.

If you use multiple characters, you need to be sure that the full string of symbols exists at each separation point in the document (as separators) and in the macro itself (in vSplitter).

[5.] Set any other macro options in the redlined User Modification Area.

[6.] Save your changes to the macro with Save & Compile on the macro toolbar (image) or with File, Save.

Play the macro on any open file that has the appropriate separators (#1 above) in it.

Once the separate files are created they can be used as Subdocuments in a Master document (See MakeSubs in the Library.)

Notes, cautions, and tips

¤ The macro starts from the very top of the document, and creates newly numbered files in sequence. The new files should then be edited to make sure they contain the proper text, formatting, etc.

Changes in formatting are sometimes the result of placing the separator in the wrong location in the original document, or because of changes in formatting above the separator location(s) that carry (or fail to carry) forward into the new, split document.

Methods exist — such as using WordPerfect custom styles at the top of each document — to ensure formatting is consistent across several related documents. [See (e.g.) the tips on the MakeSubs page — particularly Charles Rossiter's tip here, which also applies to documents split (copied) from a source document.]

¤ By design, the macro will overwrite any existing files of the same name in the new folder. If you want to preserve earlier versions of those files, you should relocate them before playing this macro (or at least rename the next batch of files using the vName variable in the User Modification Area). By default, a "Yes/No" warning is given; this message can be enabled or disabled in the macro's redlined User Modification Area.

¤ There is another Messagebox() command that can pop up a message at each "splitting" point. It may be useful for new users that are not used to the operation of this macro. You can enable or disable this message with a variable in the User Modification Area.