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

Page updated Sep 12, 2011

PageLine - A macro that produces a document Index with both page numbers and line numbers

(v1.03; 09/12/11; 144,732 bytes, including a User Guide in PDF format)

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

Related macros:

IndexList (for WordPerfect 9 and later) - A macro designed to process a user-created list of words or phrases and place page numbers after each item to indicate where in the document the item was found. Thus, it creates an Index from the List.

Unique - A suite of macros, information, and tips to help you index a document.

The standard WordPerfect index feature (Tools, Reference, Index) can create an alphabetical Index of words showing the page(s) where each word is located, but it cannot indicate the line numbers where those words are found.

PageLine.wcm (for WordPerfect 9 and later) produces Index entries that show both the page numbers and the line numbers for each entry. Some refer to this as a keyword index.

For example:

apples, 5:3; 10:1,5,7
bananas, 5:4
cherries, 2:8,10; 3:35

(The word "apples" was found on page 5, line 3, and also on page 10, lines 1, 5, and 7. The word "bananas" was found on page 5, line 4. And so forth.)

It should be most useful to those who produce straightforward, minimally formatted documents (e.g., no columns or tables) where knowing the line numbers of indexed items is as important as knowing page numbers.

The idea for the macro came from court reporters, who often need to know line numbers for indexed items.


The methods used by this macro are different from the methods used by WordPerfect's Index feature:

WordPerfect's Index feature uses words or phrases in the main document that were previously marked by the user with [Index] codes (and/or with [Bookmark: Hyperlink] concordance codes, if a concordance file was used to index the document). This is an automatic, internal process that creates an Index.

The PageLine macro uses a "source" word list, located at the end of the document to be indexed, to search for all corresponding "target" words in that document. When it finds each target item it counts the lines above it on the page by moving the cursor a line at a time. It then returns to the list and adds the page numbers and line numbers next to the listed item. This is a partly automatic, external process that converts an existing list in the document to an Index.

You have several options in creating the source list, including using an existing WordPerfect Index or a separately typed (or inserted) plain-text list. These options are explained in the instructions.


First and most importantly: Be sure to see the macro's Help buttons for instructions and other information, or consult the included (and more comprehensive) User Guide. They show how to create the source list and discuss some known limitations caused by the WordPerfect program. More than most macros, you will need to understand how this macro works to get the most benefit from it, so spend a little time reading the online Help and the User Guide. (It should take about 1/2 hour or so.) Then play it on a sample (backed up) document to see how it works.


(1) Place your cursor either on the first text item in an existing "words only" Index (i.e., an Index without page numbers; see instructions), or on the first item in any other "source word" list (e.g., a comprehensive concordance) that is typed or inserted at the very end of the document. (See Tips below.)

(2) Choose any of the menu options by checking their boxes.

(3) Click OK.

You can always regenerate the new Index, if desired, but see the User Guide for more information. (How you do it depends on which type of source list you used.)


  • You can use ListWord.wcm in the Library (included in a suite of macros at http://wptoolbox.com/library/Unique.htlm) to create a source list from the current document while you edit the document. A source list is one way to create an Index with this macro. (ListWord is a simple "select-then-copy-and-paste" macro.)
  • The macro's menu defaults and the "spacing" (comma, tab, etc.) to be used between an index entry and the adjacent page/line numbers can be changed in the redlined User Modification Area at the top of the macro's code.
  • Always make a backup of your document before playing this (or any) macro. Although it will not impact the main part of the document (it simply searches it), it will modify any existing Index entry area.
  • Long documents with lots of words to index (especially if they appear on many pages throughout the document) can cause the macro to take some time to complete. Be patient.