Gordon McComb

Free Macros and Document Automation Tools

Macros & automation tools for WordPerfect and Word

Here your'll find free tools for document automation. Many are useful as learning examples of how to write macros for custom automation solutions.

All files are provided on as as-is basis with no warranty. No support is provided. Please refer to the macro file/description for any version requirements, and special instructions.

WordPerfect Macros

Right-click on the macro file to save it to your PC.

Important! The macros have been compiled for WordPerfect X3. If you're using another version WordPerfect will force recompilation. Be sure to save the file in a folder where you have write-access.

Count Lines - cntline.wcm


Counts lines in a document, letting you specify the minimum and maximum number of characters that is construed as a line.

This macro is useful for transcribers and others who need to define a line in terms of minimum/maximum length.

Collaboration Formatting - collab.wcm


Mark and unmark text for collaborative writing/editing (redline, comment, etc.). In addition to using as an editing tool, this macro is also intended as an example of how to control text formatting via automation.

For the most flexibility, assign the macro to a keyboard or toolbar shortcut (Tools-Settings, Customize). That way you can quickly play the macro by pressing a button or key combination.

Date-to-Text - date.wcm

Exchanges [Date] codes (which automatically update as the date changes) with date text throughout the document. Use this macro when you want to permanently "stamp down" the date code with today's date as unchanging text.

This macro may be used in conjunction with a customized form-filling PerfectExpert template. Such templates run an "internal" macro that activates the form-filling process. You may combine the action of both the Date macro and template form-filling by removing the two red slash characters on Line 8 of the macro. Assign the Date macro as the Post New trigger for the template. See the template macros, triggering entry in the WordPerfect Help for additional information on using template triggers.

Format Dollar Amount - fmtdoll.wcm

Converts numeric input into a formatted dollar string. For example, enter 1002.12 and you get $1,002.12. This macro is useful as an example of manipulating text strings.

Journal Writer - journal.wcm


Write and store a daily journal or dairy notes. Demonstrates the use of simple databases, using the calendar dialog box control, and dialog box callbacks.

Note: This macro uses a deprecated (no longer supported) feature of WordPerfect, namely the BIF database engine. Do not use this method for anything critical. The support for this type of simple database may be removed in a future version of WordPerfect.

  • To set an entry, pick a date in the calendar control, and click Show Appointment.
  • Click Set to store the entry.
  • Click Delete to delete the entry.
  • Click Close to close the entry (in Entry mode), or close the dialog box.

Separating File/Path from Full Filename - pathfile.wcm

Shows how to use string manipulation to return the filename only of a path+filename string. Also shows how to return just the path of a path+filename string.

Save All Files - saveall.wcm

Your basic "save all open documents," but also demonstrates processing the command using a MessageBox Yes/No prompt.

Make-a-Box - makebox.wcm


Shortcut for creating a basic graphic box of a specified size. The graphic boxes are set with a character anchor, so they move with text. You can specify the width and height (in inches) of the box.

Daily Calender Maker - sked.wcm


Creates a personal daily schedule. The macro creates a one-page schedule, with half-hourly appointments on the left side, and three "thumbnail" calendars on the right. The calendars show the current month (with the current day highlight), as well as next and previous months.


  • Specify a name for the schedule (you can change the macro to default to any name).
  • Specify the date.

Strip HTML Tags - striphtm.wcm

Strips HTML tags from a document. The macro deletes the tags -- like <i> and <font> -- but does not take out the non-markup text in-between. Example:

This is <i>some</i> HTML.
is stripped to give:
This is some HTML.

Show System Codes - syscode.wcm


Displays important system variables. For primary use as a macro authoring tool, but is also useful for word processing writing and editing tasks.

While-You-Were-Out Notepad - whileout.wcm


Allows you to create and store "while you were out" notes. The macro also demonstrates getting time/date from system variables, and the use of multi-line edit boxes.

The notes are stored in text format, in a file named whileout.txt. The macro places the file in your document paths directory (see Tools->Settings, Files).

Set X Days Forward/Back - xdays.wcm


Add X days to the current day, and display the date in the desired format. Use a positive number to get a day in the future; use a negative number to get a date in the paste. Select Skip weekends to not count weekend days. (Sorry, the macro doesn't compensate for legal holidays.)

Set X Months Forward/Back - xmonths.wcm

Like xdays.wcm, above, but displays the date for a given month in the future or past.