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

Page updated Sep 2, 2009

Invoice - A macro that produces a customizable invoice with automatic invoice numbering

Download INVOICE.ZIP (v1.05; 05/20/08; 177,187 bytes)

Compatible with 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

Some versions of WordPerfect shipped with templates that can produce invoices, but if yours is not one of them or you would rather have a macro do the work, Invoice.wcm should do the job.

Invoice.wcm is a macro that produces either a 'Service' invoice or a 'Product' invoice. It creates the invoice in either a blank document or in the current document (such as your letterhead). It can calculate up to 20 line items (each expands with text entries), and can automatically insert an invoice number.

Sample screen shot taken in WordPerfect (the blue cell marks in the sample do not print)

Various options at the top of the macro's code allow you to completely customize it.

Several files are included:

  • Invoice.wpd - A brief overview of the macro and its operation.
  • Invoice.wcm - The main macro. Just play it to create a sample invoice. Then customize the macro with your own name, address, and choice of labels, column headings, etc. (Just open it like any other document, make your changes according to the redlined instructions at the top of the code, then click the Save & Compile button on the macro toolbar. Place the macro in your default macros folder as shown in Tools, Settings, Files, Merge/Macro.)
  • Counter9.zip, Counter10.zip, Counter11.zip, Counter12.zip, Counter13.zip, Counter14.zip - Small (18Kb) ZIP archive files containing a separate counter macro and several related files from Gordon McComb. These files are essentially identical, but the Counter.wcm macro inside each ZIP file has been compiled under the appropriate version of WP (9-X4) to prevent harmless warning messages about obsolete (but still valid) macro commands. (For WP11/SP1, it may be necessary to separately compile the Counter.wcm macro at least once before using it with Invoice.wcm.)
    • Counter is optional; however, it can create an automatically incrementing invoice number, and the code to do this is already included in Invoice.wcm.
    • Be sure to read Invoice.wpd (the Invoice "Read me" file) before extracting and using the contents of Counter.zip (then read Counter.wpd inside the appropriate Counter.zip file).

The invoice generated by this macro is made up of a single table -- part of which does some calculations (HOURS x RATE, for example). The second-to-last and next-to-last columns in the line item area can be used for any items, not just hours and rates. Just rename the column headings in the macro's User Modification Area. For example, you can use the default of DATE, DESCRIPTION, HOURS, RATE, AMOUNT, or you could use something like ITEM, DESCRIPTION, QTY, PRICE, AMOUNT. Multiple copies of the macro can produce different invoices, depending on your customizations.

All titles, labels, headings, and default text are customizable. Moreover, some of the macro's functions can also be customized.

For example, the macro can add an invoice number in one of three ways:

  • It can add a number based on the current date. (This is the shipping default.) For example, if today were Dec. 31, 2002, the invoice number would be 021231 (i.e., YYMMDD format). If you write only one invoice a day, this may suit your needs; however, you can always add a suffix to this number (-1, -2, etc.) if you write several invoices on the same day. Numbers like this identify the date the invoice was written, and will allow sorting the invoice numbers in correct "date" order.
  • It can add a numerical suffix to the above date-formatted number automatically, producing a compound number such as 021231-00129. This is done with the help of the (included) Counter macro. Numbers like this help identify the invoice by both date and specific invoice.
  • It can add just the number generated by the Counter macro (e.g., 00129). This number increments from a given starting point (which you can set), adding 1 to the stored number each time you play the Invoice macro, thereby producing unique invoice numbers. Many users may find this numbering method more convenient or useful -- but it does require an additional macro and configuration file (Counter.wcm and Counter.cfg).


  • In order to better view the invoice's table cell borders (which print) and table cell guidelines (which do not print), you might want to (1) turn table gridlines OFF with View, Table Gridlines; and (2) turn table guidelines ON with View, Guidelines, Tables, OK. (Most users probably will prefer these defaults for all tables.) For more on these WordPerfect features, see here.
  • After you create an invoice with the macro, terminate the last line of the recipient's name and address block with two (2) hard returns to allow the Format, Envelope feature to find the address for an invoice envelope.
  • A variable in Section 6 of the User Modification Area determines whether non-data areas of the table are locked. (Default = locked). When cells are locked, you can quickly <Tab> between unlocked cells. Use <Shift-Tab> to reverse direction.
  • Some of the code may be useful in creating other table-based forms with a macro. The author created most of Invoice.wcm by (1) recording several small table-creating and table-formatting steps to a separate (temporary) macro file, (2) copying these snippets back into the Invoice.wcm macro after each recording, then (3) testing/adjusting each snippet by playing the Invoice macro. (It helps to have row and column indicators turned on in the table by right-clicking inside the table and choosing "Row/Column Indicators" from the pop up context menu.)

Page Top