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 Mar 9, 2020

WordPerfect Tips
Main tips page | Browse more tips
Using WordPerfect
counters





Other automatic
numbering methods -


•  The automatic numbering (and bullet) feature [and on the same page: "Insert a paragraph number anywhere with Ctrl+Shift+F5"]

•  How to create automatically numbered document headings

•  [More:] Using, creating, modifying, and saving outlines








Unlike a structured outline where separate lines or paragraphs are sequentially numbered inside the outline according to the level they are on, WordPerfect counters can be placed anywhere in a document.

Counters are special format codes that automatically display sequential numbers, letters, or Roman numerals. You control exactly where they are located — including inside sentences, paragraphs, outline levels, footnotes, endnotes, etc.

Like outlines, the numbering sequence is maintained if you insert, delete, or move counters: The program instantly re-sequences all subsequent numbering for counters having the same name.

Note that WordPerfect uses several built-in counters, such as in graphics captions ("Figure 1," etc.). However, the following material shows how to create your own custom counters, a
nd since counters can be individually named you can create and use several different custom counters in a single document.

Note

The following menu choices refer to the <WordPerfect> menu (right-click on the top menu bar for a choice of menu). If you use a <Microsoft Word> menu, the choices might be absent from your menu (but not from the program), or they might be found under another menu selection. See here for more.

Page contents

Creating and using custom counters (basic method)

Inserting counters more easily with a QuickWord (with an example)

Including counters in a style

Creating and inserting counters with macros (with examples)

Examples of counters (elsewhere on this site)



Creating and using custom counters (basic method)

To create a custom counter:

•  Click on Insert, Other, Counter. This opens the "Counter Numbering" dialog, showing WordPerfect's 5 built-in "system" counters. [You can also open this more quickly dialog in other ways: See Footnote 1.]

Counter Numbering dialog

  Click on Create. This opens the "Create Counter Definition" dialog.

Create Counter Definition dialog

  Give the counter a unique name e.g., MyCounter, SectionNumbers, etc. (Counter names are limited to 15 characters maximum.)

  Accept the default numbering method (1,2,3) [or choose another numbering method (e.g., lowercase/uppercase letters or Roman numerals)] in the "Single level method" field.

  (Optional:) Define additional levels. Note that while you can define several numbering levels, for most tasks a single level will be sufficient.

  Click OK. The new counter should appear in the Counter Numbering dialog like this (assuming you named it "MyCounter"):

Counter numbering dialog with new counter

•  (Optional:) You can set a different starting number with the Value button. This will insert a [Count Set] code in Reveal Codes when you close this dialog.

You probably should do this optional step with the cursor at the top of the document so that using the counter further in that document will always "pick up" the new starting number. However, this is not needed if you display (i.e., use) the counter anywhere following that specified [Count Set] code.

  Click Close to return to the document.

To use the counter:

•  Place the cursor where you want the counter's numbering to appear in the document. (If you optionally set a new starting number (see steps above), click anywhere after the [Count Set] code.)

•  Click on Insert, Other, Counter to re-open the "Counter Numbering" dialog [if you need to do this often see Footnote 1].

•  Select the new counter from the Counter list, then click "Display in Document".  In Reveal Codes you will see a new code: [Count Disp], and the counter's number should appear in the document.

•  Move the insertion cursor: Make sure the insertion point is on the right side of the new
[Count Disp] code in Reveal Codes.

•  Click on "Increase" or "Decrease" to increase or decrease the value of the next displayed counter.  For example, if you want to increase the counter with each use you will see another code: [Count Inc]. If you want to decrease the counter with each use you will see [Count Dec] (but note that the displayed counter number will not go below zero to a negative number: it will remain at "0" unless you set a new positive Value).

Note

It is not recommended to use "Increase and Display" or "Decrease and Display," since the resulting codes can often be reversed from the order in which they should appear:

[Count Disp] followed by [Count Inc]

Reason:
You want to display a number, then cause it to increase (or decrease) the next time the counter is displayed further down in the document.

Tips

☼  You might need more than one named counter in a document.

For example, if you plan to use counters in both body text and substructures like footnotes or endnotes or text boxes, you should create and use separate, differently named counters for the substructures. Otherwise, the counters in one or both areas might have their normal sequential numbering interrupted.

Similarly, if you need counters for related tasks such as inserting "Question 1" followed by "Answer 1" (see an example macro to do this below) then you should create a separate (and separately named) counter for each.

☼  You can select just the two codes in Reveal Codes (using Shift+arrow in Reveal Codes makes this easier), copy them to the clipboard (Ctrl+C), then paste them (Ctrl+V) where needed.

☼  You can use existing counters more easily in any document via a QuickWord, see the next section.

☼  You can use existing counters inside a style, see the tip below.

☼  You can quickly and easily create custom counters, instantly insert them, and even reset their numbering with macros, see below.

☼  You can convert the counter to a plain text version:

This is similar to converting automatic (outline) numbers or bullets to plain text, as described here.

Caution:  This is best done on the final draft of the document when you no longer need the counters to automatically number various items and when the [Counter] codes are not embedded inside a [Style] code (where they would not be visible on the edit screen).

Method:  Basically you select the [Counter] code in Reveal Codes, press <Ctrl+C> to copy the selection, then (with the cursor on top of the selected item) immediately click Edit, Paste Special, Unformatted text.

Important:  Remaining counters will be automatically renumbered so if you need to do this for more than one counter item, start at the highest number and work backward to preserve the numbering.

To find and delete an existing counter from the document:

Counters are created and saved internally in the document. When you use them in a document their numbers/letters are displayed in the main document window.

[1] If the counter is displayed at least once, you will need to search for the existing counter codes [Count Disp] [Count Inc] (and any related text characters you might have added) in the main editing screen of the document with Edit, Find and Replace, and Replace them with <Nothing>.

[For more on using Find and Replace to search for WordPerfect text and format codes see here.]

[2] Whether displayed or not, be sure to delete the internal counter itself with Insert, Other, Counter, <choose counter name>, Delete.

[3] Save and close the document.

To change an existing counter's numbering style and/or its beginning value:

Change the style (i.e., numbers, letters, or Roman numerals):

[1] Open the Counter Numbering dialog with Insert, Other, Counter. [Alternative: In Reveal Codes, double-click on any one of the counter's [Count Disp] codes to open the Counter Numbering dialog.]

[2] Choose the counter's name, and then click Edit to open the Edit Counter Definition dialog.

[3] Set the numbering method to either numbers (1,2,3...), lower case letters (a,b,c...), upper case letters (A,B,C...), lower Roman (i,ii,iii...), or upper Roman (I,II,III).

[4] Click OK then Close to return to the document.

Change the beginning value (i.e., the  number/letter that should start the sequence at that point in the document):

[Note that this does not work with Roman numerals, at least in newer WordPerfect versions, so you will have to delete Roman numeral counters and start over with a new sequence.]

[1] In Reveal Codes, place the insertion cursor to the left of the desired item's counter codes.

[2] Open the Counter Numbering dialog with Insert, Other, Counter.

[3] Choose the counter's name and then click Value. Use the Value field to set the desired beginning value for that counter.

[4] Click OK then Close to return to the document.

To turn counter numbers/letters into plain text:

[This can be useful in the final draft of a .WPD document that is intended for distribution to others who might not use WordPerfect.]

Select the counter codes in the main document window, copy them to the Windows clipboard with Ctrl+C, then immediately paste the selected items back in place with Edit, Paste Special, Unformatted text. (In recent versions of WordPerfect this choice is also on the right-click context menu when pasting.)

Page Top

Inserting counters more easily with a QuickWord

[To create a new counter, see above.]

You can create the two codes (explained above), then select them in Reveal Codes and create a QuickWord that will insert both codes when the QuickWord is typed. 

You can also include other characters in the QuickWord, such as parentheses around the two codes. [See also the section below on using small macros to create and insert counters with additional text characters or format codes.]

Example:

The following example (repeated on the QuickWords page for convenience), shows how to automatically and sequentially number items at the end of a phrase.

It also shows how two different sequences of numbered phrases can be interspersed and WordPerfect will still track their numbered phrases independently on one another.

Using text phrases with counters -
How to use a QuickWord to insert both

This technique works somewhat like an outline, where deleted or inserted items cause automatic renumbering of subsequent items. WordPerfect will keep the lists properly -- and separately -- numbered.

For example, suppose you want to create a set of automatically numbered phrases like this (colors are simply for emphasis but could, of course, be incorporated in the actual use) -

Interrogatory No. 1.
Did you ever ....

Interrogatory No. 2.
List the people within Division who ...

Interrogatory No. 3.
State where the manager told ....

Production Request No. 1.
Produce all records in the ...

Interrogatory No. 4.
Do you claim that Mr. X never ...

Production Request No. 2.
If your answer is Yes ...

... and so forth.

Notice how the fourth and sixth item (in red) are numbered separately from the other items.

Here's how:

Step 1

Open a new, blank document. Create a single-level counter for each list item (e.g., one for Interrogatory items and one for Production items) with Insert, Other, Counter, Create, as explained above. Enter a name for the counter in the Create Counter Definition dialog that pops up, and click OK. When finished creating all counters, click Close to exit from the Counter Numbering dialog.

Step 2

In the main body of the document, type the leading text phrase and a space ("Interrogatory... "), then click Insert, Other, Counter. Choose the new, appropriate counter from the list and then click Display in Document. This takes you back to the main document. Make sure the insertion point is to the right of the new code in Reveal Codes. Then click Insert, Other, Counter, Increase.

You should now have two codes in the document,

    [Count Disp][Count Inc]in that order.

The idea is to make WordPerfect display the counter number, then (internally) increment it for any counter number that may follow later in the document. This should make it relatively immune from changing the number sequence if you copy, move, or delete such items.

Finally: Add a space, colon, hard left indent, etc., as desired to separate and/or format the text that will follow the two counter codes.

Step 3

Here's the part that automates everything:

Make a QuickWord out of the text phrase and the two codes (and any following spaces or codes) by using Reveal Codes to place the cursor just in front of (i.e., to the left of) the text phrase, and then use <Shift>+<RightArrow> keys to move the cursor to just after (to the right of) the end of the phrase and codes. This selects those items.

Now, with the phrase, counter codes, and any formatting codes still selected, click on Tools, QuickWords.

In the "Abbreviated form..." field, type the QW an easy-to-remember abbreviation, such as "\Int" (without quotes) for "Interrogatory."

Then click the Add Entry button.

(Tip: If you need help with other buttons and options on that dialog see the QuickWords page under "To create a QuickWord..." here.)

Step 4

Repeat steps 2 and 3 for the other list item. Use the other counter, of course, and give the QuickWord a different name (e.g., "\Prod" [without quotes]).

Now, when you need the items, just type the QuickWord for them, plus a space, tab, or hard return. The QW will expand and the counter will number the item. You can add or delete a counter item, or insert a counter of the second type between a sequence of the first type, and WP will keep them properly — and separately — numbered.

Note that when you create QuickWords, you should make sure that the "Expand QuickWords when you type them" box is enabled, and the Option button's "Expand as text with formatting" is selected.

Also, QuickWords are stored in a special template on each user's (local) computer, where they can be managed, backed up, and replicated on other computers: see here for more.

Page Top

Including counters in a style

[To create a new counter, see above.]

Styles are just WordPerfect codes — but codes that can contain other codes, text, graphics, headers, footers, comments, tables, table of contents markers, and — you guessed it — counters.

They act like containers to allow you to quickly apply consistent structure or formatting — such as the Heading styles that ship with WordPerfect.

For an example of including counters in a style, here's a method designed for a user who needed to number paragraphs independently of a standard outline numbering scheme. That is, the user wanted to be able to independently number these paragraphs no matter what level of outline they appeared under.

This is just a commonly requested technique; however, you can use the method with any paragraphs, not just those inside an outline.

You should only need to use this set-up method once if you save the results to your template (Step 7). But please carefully read these steps before performing them so you don't skip over an important step.

Example:

First, create a single-level counter:

Step 1. Click on Insert, Other, Counter, Create. In the "Create Counter Definition" dialog that appears, give the counter a unique name (15 characters maximum), and (optionally) choose a numbering method (numbers, letters, Roman numerals) in the "Single level method" field. Accept all other default values fields, and click OK. Close the Counter Numbering dialog to return to the document.

Next, create a style with the new counter in it, and save the style to your default or other template:

Step 2. Click Format, Styles, Create to open the Styles Editor. Give the new style a unique name and description. For the "Type," choose "Document." This is an open style that will remain in effect until the style is chosen again, at which point the number will be incremented. [You can, of course, use a Paragraph or Character style. For more on styles see here.]

Step 3. Click in the Contents field of the Styles Editor. [Optional: You can add leading text characters, such as a word or number, to the left side of the two Counter codes you will insert in Step 4.]

Step 4. From the Styles Editor's menu (top of that dialog window), click Insert, Other, Counter, and make sure the new counter you created in Step 1 is selected; then click the "Display in Document" button.
Then repeat: click Insert, Other, Counter, and make sure the new counter is selected; then click "Increase."
You should now have two codes in the Contents field:

[Count Disp][Count Inc]in that order.

The idea here is to make WP display the number and then (internally) increment it for any counter number that may follow later in the document.

Note:

When you create a counter-in-a-style this way the two codes are stored inside the new style itself. (Style codes act as "containers" for various other format codes and even text characters. For more see here and here.)

Hence you can save just the new style into your default template — or any other template — instead of having to perform all these steps (1-8) again.

Step 5. Add a period (full stop), colon, space, or other "separator" characters after the two codes. You can also add formatting to the codes (select them first), such as bold or italic and/or add tabs (Insert, Tab), indents (Format, Paragraph, Indent), or even other text characters before or after the two codes.

Remember that these additional items will also be stored inside the style itself, so if you want to make changes to them you can edit the style later using the Styles Editor. The easiest way is to apply the style in a document, then simply double-click the [Style] code for that style in Reveal Codes; this modifies the style for just that document. (If you have saved the style into a template (Step 7) you can edit the template and use Format, Styles; select the style name and click Edit.)

Step 6. Click OK to return to the Styles dialog.

Step 7. If you want this style to be available to all new documents based on the default template, make sure the style is selected in the "Available styles" pane; then click the Options button; then click Copy. Choose "Copy To: Default template," then click OK.

Tip: If you want the style available in other templates, it can be Saved/Retrieved — or copied — into them as needed. For example, once the new style is in the default template, editing any other template allows you to use the Copy/Remove Object button on the other template's property bar to copy the style from the default template into the other template. (For more information on templates in WordPerfect see the Templates page.)

Step 8. When finished, click Close to return to the document.

Step 9. Now, when you are using the main outline, you can toggle it off temporarily (usually, <Ctrl+H> or <Ctrl+T>; see here for more on this), then apply the new style. [If you are not using an outline, just apply the style where desired.] Or you can insert the style on the outline level's entry.

Tips 

You can select just the new style code in Reveal Codes and make a QuickWord out of it to more quickly access it when typing the document. 

Or, you can record a simple macro (Tools, Macro, Record) that chooses and inserts the style, and then assign the macro to a toolbar, keyboard shortcut or menu. [To assign macros see here.]

Need to make changes to the style? The counter codes and any other material you might have added into the style can be edited later by editing the style itself — either while in the document where the style has been applied (and where changes will apply to just that document) or in the template where the style was stored (for changes to the style in new documents spawned by that template).

Step 10. When you need a new number for a subsequent block of text, apply the style again; the internal counter will insert the incremented number.  

You can insert new material, or delete the [Style] code, and the other items will be automatically renumbered.


Related Tips

☼  [If using this method with a WordPerfect outline:] You may want to create several new styles-with-counters, each with varying numbers of leading tabs or hard left indents to match the indentation of the levels of the main outline. Or, simply use tabs or hard left indents to line up under the current outline level before inserting the style.

☼  Counter numbering can be reset "1" (or any other number) with Insert, Other, Counter, Value. This inserts a new [Count Set] code at the cursor location.

Related Tips:

▸ First place the cursor just to the left ("upstream") side of the document location where the counter's numbering should be reset. This will help make it easier to find the new [Count Set] code in Reveal Codes  that is responsible for the new numbering, if you wish to delete it.

Also, you can always double click on the [Count Set] code in Reveal Codes to set a new value for the number at that point. This is a quick way of setting a new starting number for that specific counter.

If you use the Counter Numbering dialog often you can assign it to a keyboard shortcut or toolbar button. See Footnote 1 below.

The [Count Set] code itself can also be turned into a QuickWord.

☼  You can write a macro to insert the style at the cursor location, using the single macro command StyleOn("<stylename>"), where <stylename> is the name of the new style. The macro can then be played with a keyboard shortcut or toolbar button; see here.

☼  You can use a macro to create various styles-with-counters, as explained in the footnote on the Outlines page.

☼  To cross-reference these counters:

•  Place your cursor just to the left of the [Style] code in the main document. For example, if you have created a Paragraph style with an embedded counter, you should see this string of codes wherever the style was applied; just place you cursor where indicated below:

[Para Style>*[Style]<Para Style]

   * = cursor location

•  Click Tools, Reference, Cross Reference. In the Reference Tools dialog that appears, choose "Counter" as the Reference Type. The Counter dialog appears.

•  In that dialog, choose the custom counter you created in Step 1 at the top of this section (above), then click OK.

•  Back in the Reference Tools dialog, give the Target a name in the Select Target field, then click on Mark Target.  A [Target] code will appear at the cursor location in the document, like this:

[Para Style>[Target][Style]<Para Style]

•  Repeat the above for your other Counter cross references until all [Target] codes are inserted in the document, adjacent to their [Style] codes.

•  Next, create your text references. Place your cursor at the appropriate location(s) in the text area of your document and create the reference(s) with the Mark button (not the Mark Target button) on the Reference Tools dialog. Before marking them, be sure the Reference Type is set to "Counter." Then set the Select Target to the appropriate target name for the current target.

Note: This step places a temporary "?" in the document, which will display the actual counter's number/letter when you generate the references.

•  Once finished creating your references ... click on Generate (or you can generate later from the Tools, Reference menu).

☼  If you have created short Paragraph or Character styles-with-counters, you can have WordPerfect include these styles in a Table of Contents.

Page Top

Creating and inserting counters with macros

Macros can automate creating and inserting counters — sometimes more easily than the basic, QuickWord, and style methods above.

The information below demonstrates how to automatically and instantly  create and insert a new counter into the current document in one step with a small macro.

NOTE [March 2020]:
I found that the macros below work well when inserting or moving counters that they create. However, they can (oddly) produce non-sequential numbering when such counters are deleted and then reinstated.
    Therefore I recommend using the "counters in a style" method above, which takes a bit longer to set up initially but works reliably when deleting...reinstating counters.
    However, you can still use a macro to insert a custom counter (such as the ones in the macros below) when you are editing a document: You just have to record a simple macro to insert the style, as noted in the above section. (The recorded macro can be assigned to a keyboard shortcut, if desired, so you can insert the counter quickly and easily while typing.)

(To use a macro to create the counter and insert that count in a style as discussed above, see the footnote on the Outlines page here.)

To illustrate the process -

You can select and copy the macro examples below (in dark red) into your WordPerfect program's default macro folder (see here for help if you need it). 

Tip:

Before playing one of them, you can change the name of the counter in the macro where indicated, if desired. Then use the Save & Compile button on the macro toolbar that appears when you edit a macro. (Again, see here for help if you need it.)

Then you can assign the macros to separate keyboard shortcuts, toolbar buttons, or menu items for quick and easy access (see "Customizing WordPerfect" here for help).

Tips:

☼  If you frequently need to use several differently named counters, each created/inserted with a different macro, you can add the macros to a new top menu list for convenient access.

☼  If you prefer to use toolbar buttons, you can add them to any existing toolbar or property bar, or create a new custom toolbar for the purpose.

☼  If you prefer to always use the keyboard, you can create a "two-key" macro to play the various counter macros with nothing more than a couple of keystrokes.

☼  Want to change an existing counter's numbering style or beginning value? See the methods above.

☼   Want to change any customizations that you have added to the counter numbers, such as preceding or following text characters? Remember that you can search for their existing counter codes [Count Disp][Count Inc] (and any related text characters you might have added) in the main editing screen of the document with Edit, Find and Replace. You can then Replace them with other things — or with <Nothing>, which will delete them from the main screen.[For more on using Find and Replace to search for WordPerfect text and format codes see here.] [Note: Such changes do not change the internal counter's numbering style or its beginning value. For those, see the methods above.]

Worth repeating: The examples below are separate macros.

Example 1 creates a single level increasing numerical counter (if it has not already been created) and inserts the counter in the current document at the cursor location.

When played you will see the same two adjacent counter codes as discussed in "Creating and using counters" above. Play it when you need a new counter number in the text.

Note that it optionally adds square brackets around the counter number ("[1]", "[2]", etc.). Delete the two Type() commands if you don't want them or add or replace their parameters with something else (such as parentheses or spaces).

Example 1a is a variation of that first macro and shows added text (e.g., "Question ", or "Answer ", etc.) before the counter number and a colon (":") after it. This type of macro can also be used for simple numbered or lettered section headings (including Roman numerals such as "Part I", "Part II", etc.).

Example 2 is similar to Example 1 (though differently named) — but the counter it creates decreases its number with each play of the macro. [Tip: Set the Start number to the maximum number so that the numbers are always positive.]

Advantages to these (or similar) macros -

Using a macro such as one of these examples has a big benefit over using plain text numbering:

Inserting the cursor between any two displayed counter numbers and then playing the macro will cause all following (same name) counter numbers to automatically adjust their numbers.

Similarly, deleting an intervening counter will "close up" the following numbers. (But see the tip about using counters in both body text and in footnotes, text boxes, etc., above.)

Obviously there are many other uses for such text-plus-counter-number macros.

You should test the macros in a new document.

Add a few lines of text and play the desired macro in several document locations, including adding text between the counter numbers.

Note that their numbering retains a numerical sequence even if you delete one or more of them or insert new ones between existing ones.

Make them easy to use.

Finally, you can assign the macros to separate keyboard shortcuts, toolbar buttons, or menu items; see here for information.

Tips about these particular macros

☼  If you don't need parentheses around the counter numbers, delete both Type() commands in the Example 1 macro below.

☼  You can use other characters in the Type() command — either as single characters as in the examples, or in combination with other characters such as spaces or symbols such as bullets (Ctrl+W).

☼  Instead of (or in addition to) text characters like parentheses, brackets, spaces, etc., you can use other special fornatting commands like Tab, Indent, and paired commands like -

AttributeAppearanceOn(Attrib:Bold!) ... AttributeAppearanceOff(Attrib:Bold!)
to surround the counter display code.

[See the program's Help, Macro commands for other related commands (or ask for help at other WordPerfect user sites like WordPerfect Universe.]


Example 1


A macro to create and insert a single-level numbered increasing counter with optional brackets (or you could use parentheses, etc.) around the numbers (see also the tip about using counters in both body text and in footnotes, text boxes, etc., above):

Tip: To copy the macro code below into your WordPerfect program to create working macros, see here.

Tip:
In the CounterCreate() command you can set the numbering method to Numbers! (as in the examples), LowLetter!, UpLetter!, LowRoman!, or UpRoman! (for lower/uppercase letters and Roman numerals).

Caution:
Be sure to create and save separate (and uniquely named) macros for different numbering methods and/or when you wan to use different adjacent text characters (see Example 1a below) so they don't conflict with each other if used in the same document.

// Macro begins here
// Purpose:
// Create and insert an increasing number counter in the current document.
// IMPORTANT: Enter your preferred counter name between the quote marks

vCounterName:="MyCounter"

// Create and insert the counter:
// If the counter exists in the document, skip create step:
OnError(SkipCreate@)
CounterCreate (vCounterName; Numbers!)  // (create counter)
Label(SkipCreate@)  // (jump here if counter already exists)
Type("[")  // (optionally add open bracket)
CounterDisplay (vCounterName; 1)  // (display the counter number)
CounterIncrement (vCounterName; 1)  // (increment next counter if any)
Type("]")  // (optionally add closing bracket)
If(?RightChar<>" ") Type(" ") Endif // (optionally add a trailing space)
Quit
// Macro ends here

Example 1a (automatically numbered Questions and Answers)

Here's a variation of Example 1 that adds a text prefix to the Counter. It will produce "Question 1: ", "Question 2: ", etc.

Note: Create and save a separate macro to insert "Answer 1:" etc., by changing both the counter's name and the typed text to something like vCounterName:="Answers" and Type("Answer ".

// Macro begins here
// Purpose:
// Create and insert an increasing number counter in the current document.
// IMPORTANT: Enter your preferred counter name between the quote marks

vCounterName:="Questions"

// Create and insert the counter:
// If the counter exists in the document, skip create step:
OnError(SkipCreate@)
CounterCreate (vCounterName; Numbers!)  // (create counter)
Label(SkipCreate@)  // (jump here if counter already exists)
Type("Question ")  // (add text prefix plus a space)
CounterDisplay (vCounterName; 1)  // (display the counter number)
CounterIncrement (vCounterName; 1)  // (increment next counter if any)
Type(":")  // (add closing punctuation -- e.g., a colon)
If(?RightChar<>" ") Type(" ") Endif // (optionally add a trailing space)
Quit
// Macro ends here

Example 2 (decreasing numbers)

Here's a macro that creates and inserts a single-level numbered decreasing counter from a specified starting number, with optional parentheses around the numbers (see also the tip about using counters in both body text and in footnotes, text boxes, etc., above).

Tip: To copy the macro code below into your WordPerfect program to create working macros, see here.

Note the use of a different name from the previous examples since it does a different job.

// Macro begins here
// Purpose:
// Create and insert a decreasing number counter in the current document.
// IMPORTANT: [1] Enter your preferred counter name between the quote
//
marks; then [2] enter the starting number for the counter to use.
// (Note: A decreasing counter will stop at zero.):

vCounterName:="MyDownCounter"
vStartNumber:=100

// Create and insert the counter:
// If the counter exists in the document, skip create step:
OnError(SkipCreate@)
CounterCreate (vCounterName; Numbers!)  // (create counter)
CounterSetValue (vCounterName; vStartNumber)
Label(SkipCreate@)  // (jump here if counter already exists)
Type("(")  // (optionally add open parenthesis)
CounterDisplay (vCounterName; 1)  // (display the counter number)
CounterDecrement (vCounterName; 1)  // (decrement next counter, if any)
Type(")")  // (optionally add closing parenthesis)

If(?RightChar<>" ") Type(" ") Endif // (optionally add a trailing space)
Quit
// Macro ends here

Page Top

Examples of counters (elsewhere on this site)

•  Using counters to automatically number table rows (or items) when you merge into a table

•  Using a two-level counter in graphic figure boxes (e.g., Figure 1.1, Figure 1.2, etc.)

•  Outline-in-an-outline. Use a counter inside a paragraph style for the first level, and a standard numbered Outline for the second level
...and... Counter in a style - a macro approach

•  Create automatically numbered (or lettered) heading styles

•  (Macro:) Para#End - Numbers each paragraph at the end of the paragraph

Page Top



Footnote 1

[Continued from above...]
Opening the Counter Numbering dialog with
a keyboard shortcut or toolbar button:


If you find that you use this dialog a lot, or you don't want to use the macros above, you can assign this dialog to a keyboard shortcut (e.g., <Alt+C>) or a toolbar button for easy and quick access.

In the Keyboard Shortcuts dialog or the Toolbar Editor dialog, the feature is found under the Insert category; scroll down to "Counter..." and select it for assignment. For more on how to do this see the "Customizing WordPerfect" page here.

Note that this opens the Counter Numbering dialog at the current cursor position. Hence if you are trying to set a different starting number for the counter you might need to position the cursor just after (to the right side of) its specific [Count Set] code, then use the dialog's Value button to set a new starting number.