|
[Both macros
are based on John Land's public domain macros.] |
(1) DELCODES.WCM deletes selected single
codes from a document such as [Bold On], [Hypertext Begin],
[Para Spacing], [Tab Set], etc. Many of these codes are actually
the beginning code that is part of a pair of codes surround text;
deleting the first code will automatically delete the second
(ending) code. Other codes, such as [Tab Set], are strictly single
codes and are not part of a pair. The list of codes presented
in the opening menu (see screen
shot) can be modified in the macro code (see "Modifications"
below).
(2) DELPAIRS.WCM deletes pairs of
"empty" attribute or appearance codes such as [Und
On][Und Off] that may have been left behind in a document after
editing. They are "empty" because there is no text
between them. DELPAIRS is very useful in cleaning up clutter
in the Reveal Codes window.
Tips
- To delete all codes in a selection
of text you don't need a macro. Simply select the text and copy
the selection to the Windows clipboard (usually with Ctrl+C).
Then immediately paste the copied (and still selected) material
back in place with Edit, Paste Special, Unformatted text --
overwriting the original material. This strips out all formatting
codes. For a macro (and some shortcuts) to facilitate the pasting
process, see here.
- For a macro that can clean up extra codes
inserted when you import a Microsoft Word document, see Mike
Koenecke's Word Cleanup macro, park of his MAKMacros
suite,
Modifications
The DELCODES.WCM macro can be modified to
include (or remove) codes from the menu list. Simply open the
macro with Tools, Macro, Edit. Scroll down to the area that contains
this instruction:
"Code list - the format is a text label
typed into the left column, than a tab, then a code is inserted
in the right column (codes are entered with the Codes button
on the Macro Toolbar) - open Reveal Codes to more accurately
see the format on a particular line below. Note the use of semicolons
(not colons)."
Directly under that paragraph you will see
a list of codes in two columns, like this:
Global vItemList[]= {
{"[Bold On]"; "[Bold
On]"};
{"[Bookmark]"; "[Bookmark]"}; ... {"[Wrd/Ltr
Spacing]"; "[Wrd/Ltr
Spacing]"}
}
You can follow the same pattern to add more
labels and codes. Note two things:
1. The items in red (in the right-hand column)
are codes and must be inserted using the Codes button on the
Macro Toolbar that should be visible (if it is not, click Tools,
Macro, Macro Toolbar). Then the macro will be able to find them
if they exist in the document. The items in the left-hand column
are merely text labels for the macro's menu list. The two items
are separated with a Tab.
2. The very last line item (see [Wrd/Ltr Spacing]
above) in the list does NOT end with a semi-colon. All other
lines MUST end with one (semi-colons are used as separators).
|