|
See also Clipper |
Purpose
This macro 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 current document is not affected since
the macro simply copies selections (delimited by certain separators)
and saves the selections in new, sequentially numbered files
in a specified storage folder.
(Note that if the 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 numberbefore
or after the root filenamecan 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.]
Instructions
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 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 and if it is a
copy of the original it can be discarded.
Here, 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 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.
Now, modify the macro. (A WordPerfect macro can be opened and saved like any
other document.) Normally, this is a one-time procedure.
2. Create a special storage folder on your
computer to store the new files. Use
Windows Computer or Explorer to create the new folder in any
convenient location. It 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 C:\Users\Barry\Documents\Temp2\.
You can also change the root portion of the filenamesi.e.,
the part without the incrementing numberand/or filename
extension (.wpd is the default) to use for the new files to be
stored in that folder.
4. Enter the same symbol(s) or character(s)
(discussed in #1 above) in the macro's
redlined User Modification Areasee 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.
Recommendation:
Try to use a single symbol or character as the separatoralthough
the macro should compensate for multiple symbols/characters.
If you use multiple characters, you need to be sure that the
full string 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.
Play the macro on any open file that has the appropriate separators
(#1 above) in it.
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 usually the
result of placing the separator in the wrong location. Use Reveal
Codes to relocate any such separators.
- 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 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.
|