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-2017 by Barry MacDonnell. All Rights Reserved.

Page updated Jul 14, 2017

BATES - Macros that create sequential, fixed-width "Bates" numbers (e.g., 00001, 00002, etc.), with or without preceding/following text material

Download BATES.ZIP - (v1.10; 05/28/10; 55,052 bytes

Bates numbering.wcm is compatible with versions WordPerfect 7 and later versions

Bates numbering for multi-page documents.wcm is for WordPerfect 9 and later 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

Contains two macros:

Both macros allow inserting additional text adjacent to the Bates numbers.

Tip: See also QWIKFILL, which can fill a table column with Bates numbers.

Bates numbering.wcm (Compatible with versions WordPerfect 7 and later versions.)

What is a Bates number?

Bates numbers have a fixed width -- that is, a fixed number of digits (defined by the user) -- and sometimes contain alphabetical characters. For example:

  • 001, 002 ... 999
  • A1001, A1002 ... A9999
  • Ticket #00000200, Ticket #00000201 ... Ticket #99999999

This macro can -

  • create sequential, fixed-width Bates numbers on blank Avery® label or card stock, or
  • stamp the Bates numbers directly on single-page pre-printed forms, letters or legal documents already in your printer's tray, or
  • include the Bates numbers in an existing WordPerfect document, which is expanded by the macro to "x" copies of the original document, with each numbered as specified.
Multiple options are available from a menu, including -
  • ability to place the Bates number stamp precisely where desired (via a special bookmark) on each stamped item;
  • set the total number of digits (the "fixed width") in the Bates number;
  • set the range of the Bates numbers;
  • choose the number of copies of each Bates item;
  • set the font appearance of the Bates number (bold, italic, underlined, small CAPS, or redlined) and/or relative font size (normal, fine, small large, very large, extra large);
  • insert preceding or following text (or both) around the Bates number, optionally separated by hard returns to create 2- or 3-line Bates stamps (see "How does it work?" below).

Some typical uses:

  • Labels ("stickers") to use for labeling items; Avery's 80-label stock works well for this.
  • Labels formatted with other text or graphics (say, your firm's name or logo, or the current date).
  • Small cards for numbered admittance tickets, etc.
  • Numbering the current document (which, when printed, will produce "x" copies of the original, each numbered with a Bates number)
  • Numbering pre-printed documents, such as single-page forms or legal documents, that you load into your printer's tray. (See also the companion macro, Bates numbering for multi-page documents.wcm, below.)
  • How does it work?

    The macro uses a special bookmark (bates#) that -either- you place on the first label (or on a document's page) -or- you have the macro place it for you at the current cursor location (or at the bottom of the item; for labels, it also can be centered horizontally and vertically).

    With this technique you tell the macro exactly where you want the Bates number. It then looks for this bookmark and enters the next Bates number in the sequence; it then goes on to the next label or page and repeats the process. (Those interested in writing macros may want to examine the macro's two nested ForNext() loops that actually generate the Bates numbers.)

    When the macro plays, a menu allows entering any preceding (leading) text characters, spaces, and returns, as well as materials that should follow the numbers. For example, you can produce "Bates numbers" like this:

    Client Document # A000123 - Confidential

    Since you can enter carriage returns in these menu text fields (or by checking the HR boxes on the menu), you can easily produce labels like this:

    The XYZ Corp.

    You can specify the number of digits (the width of the Bates number), the starting and ending numbers, and the number of copies of each numbered item (which will be printed adjacent to one another). You can also specifiy relative font size, and appearance (bold, italic, underlined, and small caps). The macro then creates Bates numbers with these attributes.


    • If you want to use a Bates number on each page of a single, multi-page document, use the companion macro, Bates numbering for multi-page documents.wcm (below).
      • [Note that if you play the Bates numbering.wcm macro on a multi-page document, it will place a Bates number just once on the document (just as it would place it just once on a completed, filled sheet of labels/cards), and then make multiple copies of that multi-page document. For example, if you tell it to Start numbering with "1" and End numbering with "80" (the default menu choices), you'll get 80 copies of the same multi-page document, each with a single, incrementing Bates number on them!]
    • Instructions are included via the Help and How buttons on the macro's main menu. Also, the macro code can be modified in the redlined User Modification Area to set the opening menu's defaults or set a different font for the Bates material.


    • Need to create a table with custom Bates numbers in one column and another column for annotations? Here's how.
      • Open a new (blank) document. Play the 'Bates numbering' macro to create as many numbered pages as you will need rows in a table. Use the default radio button choice at the top of the macro's menu, and answer 'yes' to the pop up message ('Oops...') about creating a bookmark. You should now have a document with as many pages as numbers.
      • Open Reveal Codes and delete the [Bookmark] code from the top of the document (it is not needed).
      • You will now replace all hard page breaks with hard returns. Click Edit, Find and Replace, Match, Codes. In the Codes dialog that pops up, choose the [HPg] code to Insert in the 'Find' field, and the [HRt] code to Insert in the 'Replace with' field. Close the Codes dialog, and click Replace All in the Find and Replace dialog. Click OK to return to the document, which should now contain a single column of Bates numbers, each separated by a hard return code [HRt].
      • Convert the column of numbers to a table. Click Edit, Select, All to select the column of numbers. Then (in WordPerfect 10+) click -either- Table, Create, OK -or- Table, Convert. For 'Format' choose 'Size column to fit' and for Text Delimters, choose 'Paragraph.' Click OK. You should now have a one-column table with as many rows as you have Bates numbers.
      • Place the cursor in the table, and right-click it. Choose Insert from the context menu that pops up, then click the 'Columns' and 'After' radio buttons. If you set Columns to '1' you will create a table with an empty column to the right of the Bates numbers column. Drag the right-hand table border to size the column to your needs.
    • Alternative: WordPerfect X6 now includes a Bates macro, which can optionally process multiple documents on disk. You can compare the other options on its main screen: WPX6 Bates macro vs WPToolbox Bates macro. You should test both to see which suits your needs.

    Bates numbering for multi-page documents.wcm (Compatible with WordPerfect 9 and later versions.)

    [Update (May 11, 2012): WordPerfect X6 now includes a version of this macro that can be accessed from its Legal toolbar or its Tools, Legal Tools menu. It can also process multiple files at once. A separate macro can remove the Bates numbers.]


    This macro creates sequential, fixed-width Bates numbers (e.g., 0001, 0002) on each page of an existing multi-page document (or filled Avery® label/card sheet), in any one of 12 locations around the perimeter of the pages. The numbers are inserted in a full-page text box inside a watermark created on each page (or label/card).

    When played, the macro creates a copy of the document in a separate window, so that processing will not affect the original. This is the default, but you can change it in the menu. Other menu selections provide for inserting text adjacent to the Bates numbers, similar to the Bates numbering macro described above.

    Modifications to default menu (and other) values can be set in the macro's User Modification Area.

    [Note: Multiple text boxes on the main document page level are problematic in complex documents; hence, in this macro text boxes inside watermarks are used instead.]


    The macro can be played on any normal document, or on a filled sheet of labels/cards. [The latter must already be expanded on screen to show several (or all) labels/cards on the physical sheet of paper stock, not just the first one. To use Bates numbers on a single, "master" label/card and have the remaining labels/cards created automatically, you should use the companion macro, Bates numbering.wcm.]


    Modifications to default menu (and other) values can be set in the User Modification Area. For example, you can set

    • a new font type for each section of the Bates material (text and numbering); this might be useful if the text or Bates number is a bar code font, or you simply want to change the appearance of optional text, perhaps because it is on a separate line from the Bates number
    • default menu values for (optional) text that should precede or follow the Bates number
    • This macro can be used to create a second page numbering system on the same pages, typically for a different page number sequence than that used by the WordPerfect page numbering system. Since the macro works by typing an incremented number into the document on each page, it does not depend on the built-in page numbering system.
    • If you do not want to use leading zeros you can simply "comment out" the command Type("0") at about line 397 in the macro's code by placing two slash marks (//) in front of it. This command is in the section entitled "Create the Bates number for the current page." Then click the Options button on the macro toolbar and save the macro under a different name so that you can have both versions handy.

    Page Top