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

Page updated Dec 27, 2022

Convert Case ("toggle case") - a macro that converts a selection of text into either 

• UPPER CASE ['ALL CAPS']
Initial Capitals for the Main Words ('Title case' or 'Headline case')
Initial Capitals For All The Words (Alternative Title case)
Initial capitals for first word ('Sentence case')
• Initial capitals for first word ONLY ('Smart sentence case')
• lower case
• Reverse case of every letter ('cAPS lOCK' fix)

    [Reverse the case... is also included as a separate macro in the download ZIP file. See below.]

Download CONVERTCASE.ZIP (v1.05; 12/21/2022;
28,013 bytes)

Convert case.wcm was originally written in WordPerfect X5, and recently updated and tested in WP2020.

Reverse case.wcm (included in the ZIP file) was written in WordPerfect X7.

Downloading, Documentation, Modifications, and Support

Disclaimer


Note

WordPerfect menu choices on this page refer to the <WordPerfect> menu (right-click on the top menu bar for a choice of menus). 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.


Related pages and other items -

•  CapFirst -
A macro that converts just the first letter in a sentence to UPPER case if it's not already in upper case, without affecting any other upper case letters in the sentence.
   Similar to the Convert Case macro's Sentence case — but it converts only the first letter of the sentence, which might be more useful during some editing tasks.

•  RLCaps - A macro that finds every capital (uppercase) letter, then emphasizes it with redline. It can optionally add large size, bold, and/or italics, Like This. Changes are easily undone.
   This makes capital letters easy to find when proofreading the document. (See the footnote on that page to add a new font to upper case letters.)

•  ConvertV - A macro that converts selected text to Initial Capitals, then replaces any uppercase in the selected block to their lower-case equivalents (e.g., it converts
"V." and "VS." to "v." and "vs." — or "SMITH V JONES" to "Smith v Jones").
   No menu appears to make it very quick and easy to use.

•  Smallcaps2Caps - Convert Small Caps (a text attribute: Format, Font, Small Caps) to ALL CAPS with the small macro in Footnote 3.

Convert case.wcm (v1.05)
[Updated in December 2022 with a new 'Smart sentence case' choice]
Convert case is one of two macros in the Download ZIP file (◄- left sidebar).
The other macro is a standalone version of Reverse case (see below).


Background and purpose


Over many versions, WordPerfect has included a built-in menu selection, Edit, Convert Case, to convert the current word or a selection of words to lower case, UPPERCASE, or Initial Capitals (for all words in a selection).

However, in WordPerfect X8 and earlier versions the first choice on that WordPerfect menu -- lower case -- had a perceived limiation: It left the first word of sentences capitalized (if they already were capitalized) in a selection of text. This appears to have been by design. However, some users wanted all characters in a sentence to be in lower case when using that choice.

Corel addressed this issue in two ways: They added a new choice on the WordPerfect X9 (and later versions) menu: Edit, Convert Case, Sentence Case -- which creates an initial capital letter followed by all characters in lower case. And they fixed the lower case choice to convert all letters in a sentence to lower case.

Hence, the Convert Case.wcm v1.03 macro (revised in 2018) also included two new choices: lower case for all the words and Initial capitals for first word (a.k.a., 'Sentence case'). These produce the same results as the WordPerfect X9 menu -- and they work in both later and earlier versions of WordPerfect. [Code was added to detect the user’s version and use appropriate macro commands for the version.]

Unfortunately, sometimes we fix one thing and miss fixing other, even fairly obvious, ones. Users soon noticed that the new Sentence Case "fix" had the unwanted effect of converting some items -- proper nouns, abbreviations, acronyms, etc. -- in sentences to lower case when they should have retained their uppercase characters.

As a result, a separate macro was created to address this issue: Capitalize first letter in a sentence.wcm (downloadable in the WordPerfect Toolbox library at https://wptoolbox.com/library/CapFirst.html).

Finally
, in this Convert case.wcm v1.05, some of the code from Capitalize first letter in a sentence.wcm was incorporated as a menu choice: Initial capitals for first word ONLY.

Convert case macro menu
[N.B.: The name "Smart sentence case" (fifth menu choice) does not imply that other choices are "dumb" -- just that the macro code does things the way a human would do them: by "looking" at the case of the first letter of the first word, and ignoring all other items in the sentence -- including, of course, any words with uppercase letters.]

Compared to the WordPerfect menu, you have three additional functions to help deal with various case-conversion issues, and all conversion choices can be accessed with fewer keystrokes or mouse clicks.

When you play the macro

Once you have downloaded the macro's ZIP file and extracted the macro (see instructions if you need help) you can play it quickly (Tools, Macro, Play) to convert a selection of text into either -

    [1]  UPPER CASE ('All Caps')
    [2]  Initial Capitals for the Main Words ('Title case' or 'Headline case')
    [3]  Initial Capitals For All The Words (... an alternative Title case)
    [4]  Initial capitals for first word ('Sentence case') *
    [5]  Initial capitals for first word ONLY ('Smart sentence case') **
    [6]  lower case
    [7]  Reverse case of every letter ('cAPS lOCK' fix ) ***

*  Sentence case (choice 4) also converts any other upper case items in the same sentence to lower case. [The same thing happens with the same choice on the WPX9+ Edit menu.]

Tip: Most initial-caps-for-first-word tasks probably will benefit more from using choice 5 instead, but of course it depends on your needs.

**  Smart sentence case (choice 5) retains any other Upper Case items in the same sentence -- like THIS one. [To date, WordPerfect cannot do this using any built-in function.]

Note: Smart sentence case will process just a single sentence in a selection of text -- i.e., the first sentence in a large block of selected text. To process sequential sentences, consider using the CapFirst macrowhich employs much of the same macro code but with the (default) option of proceeding step-wise through the document without having to manually select subsequent sentences.

***  Reverse case (choice #7) can correct for the accidental use of the Caps Lock key (e.g., it changes tHIS to This). [To date, WordPerfect cannot do this using any built-in function.]

Tip: This function is also included as a separate macro in the download file along with Convert case.wcm.

Prevention tip: See "Make the <Shift> key turn <Caps Lock> off automatically" here to help prevent accidental use of the Caps Lock key while typing in WordPerfect or in any Windows program.

Make it easy to use

Since the macro's menu uses push buttons that can also be activated with the press of a key, the macro and its choices can be used entirely from the keyboard (i.e., a "two-key macro") by assigning the macro itself to an available, easy-to-remember keyboard combination such as <Alt+C>.

Then, for example, when you press <Alt+C> and immediately follow it with either the <U>, <M>, <A>, <S>, <F>, <L>, or <R> key (these are displayed on individual push buttons) the macro will dismiss the menu and perform the chosen function on the selected text.

You can, of course, also use a mouse to make your conversion by clicking on the appropriate pushbutton on the macro's menu. If you use a mouse, you may prefer to create a button on a toolbar that brings up the macro. Or, if you prefer using the WordPerfect menu, it could be useful to create a new menu selection to launch the macro. (Or you can create all three -- keyboard assignment, toolbar button, menu choice -- if you have multiple users on your system that have different input preferences).

Notes and tips

•  Except for the reverse case option, this macro leaves the converted text selected on screen so that you can make other changes to that text.

    To unselect it, simply press an arrow key (or click elsewhere) and you can move past the selected text and de-select it at the same time. If you prefer to have the macro automatically de-select the text see the simple adjustment in the macro code's redlined User Modification Area.

    [Macros can be edited like any other WordPerfect document: simply either click Save & Compile from the macro toolbar that should be visible, or just save the file with File, Save.]

•  You should always review changes to be sure they are what you expect. You can usually undo changes with Edit, Undo or <Ctrl+Z>.

    For example, hyphenated words such as "de-select," "natural-born," etc., are considered a single word in WordPerfect; thus the use of the Initial Capitals and Reverse Case options will ignore the second part of such compound words. This might or might not be what you want.

¤  For the first two Initial Capitals... menu choices (#2 and #3) on the macro's menu, be sure to read "Initial Capitalization in Titles and Headines" below.

¤  The Initial Capitals choice on the WordPerfect menu as well as on the Convert case macro's menu (i.e., choice 2) depends for its operation on a special WordPerfect file which contains minor words (e.g., "a") that should be excluded, such as in headlines or titles. This exclusion file is an editable file whose contents differ according to your language version. See Footnote 2 below for more information.

•  [WordPerfect X8 and earlier versions:] The menu choice, lower case for all the words, might take a few seconds on very large blocks of text. The screen will go blank while it does the conversion. [You can always stop any macro by right-clicking on the (cassette) icon in the Windows notification area (a.k.a., system tray).]
•  Initial capitalization in titles and headines.

According to the Chicago Manual of Style (CMS) FAQ site (Capitalization,Titles), the rules about titles or "headline-style capitalization" are somewhat flexible. As they stated in an old FAQ:

In regular title capitalization, also known as headline style, the first and last words and all nouns, pronouns, adjectives, verbs, adverbs, and subordinating conjunctions (if, because, as, that, etc.) are capitalized. Articles (a, an, the), coordinating conjunctions (and, but, or, for, nor [so, yet]), and prepositions, regardless of length, are lowercased unless they are the first or last word of the title or subtitle. ...

They conclude that "considerations of meaning and aesthetics can probably be let in". In other words, the rules are sometimes broken, depending on what seems appropriate at the moment. Still, rules should be understood before you break them.

How does this relate to WordPerfect?

WordPerfect stores exceptions to the rules for initial capitalization (i.e., when you use Edit, Convert Case, Initial Capitals) in a normal WP file, WTNNXX.ICR (where NN is your WordPerfect version number and XX is your language version). Words in this file will be NOT be capitalized when the Initial Capitals feature is used.

The WTNNXX.ICR file can be edited as any other WP file to add or delete words (punctuation is ignored) (see Footnote 2). However, it does not contain a comprehensive list of prepositions (see the CMS quote above). In any case, many such words can also be nouns, adverbs, or adjectives. So, bear in mind that if you use WP's Initial Capitals feature with titles or headlines, you may want to inspect the conversion to ensure it meets standard rules such as those embodied in the CMS, or that it meets aesthetic needs [e.g., John Updike’s Rabbit is Rich (lower case "i") makes more sense than Rabbit Is Rich (upper case "I"), even though the rule says the word "is" should be capitalized, and WP will dutifully capitalize it].

On top of this, for some reason there is a large difference in the exception lists for the US/CE language versions of the .ICR file (which contain 70 words) and the UK/OZ versions (13 words). For example, the letter "a" is not in the UK/OZ exception files, and the conjunction "nor" is missing in all four English language lists, which means it will always be capitalized.

WordPerfect is a computer program, after all. Don't expect it to take the place of your own judgment.

☼  Initial Capitals for Main (or All) Words is something that is generally used for titles or headlines (see previous tip) — not for headings. See, for example, Practical Typography - headings here.

[Page top]
    Reverse case.wcm (v1.01)

    [Note: The function of this macro is included in the Convert case.wcm macro above (and is available from its pop up menu), but a separate Reverse case.wcm macro file is also included in the download ZIP archive for those who just need that function.]

    Purpose

    This macro is designed specifically to let you quickly reverse the case of each letter in recently typed text (or any text).

    This can help when the Caps Lock key was left "on" while you were typing and you didn't notice because you weren't looking at the screen at the time.

    If so, pressing the Shift key while typing with Caps Lock on reverses any capital letters, like this example:

    "tHE iNTERNATIONAL bUSINESS mACHINES cORPORATION (ibm) IS AN aMERICAN MULTINATIONAL TECHNOLOGY CORPORATION."

    This reverses the case of the letters from what you intended. The macro can correct this error almost instantly, to this:

    "The International Business Machines Corporation (IBM) is an American multinational technology corporation."

    The macro can also be useful to instantly change a lower case word under (or to the left of) the cursor to all CAPITAL letters, or vice versa.

    Instructions

    Just place the cursor on the incorrect word or select the incorrect text (e.g., use Shift+arrow or the mouse), and then play the macro. [Note that no menu is displayed since none is needed. However, with version 1.01 there is a pop up dialog to show a running count of letters processed and also allow you to cancel further operation of the macro (useful if you selected too much text).]

    If nothing is selected the macro will attempt to select the item under, or to the immediate left of, the cursor.

    Notes and tips

    ☼   For quicker access to the macro you can assign it to a shortcut key, toolbar button, or menu choice (see http://wptoolbox.com/tips/EasyPlay.html). For example, if the shortcut key Alt+Z is available for assignment (see http://wptoolbox.com/tips/Assign.html), it might be a good candidate to play the macro since a similar shortcut, Ctrl+Z, is the standard Undo key for many other things in Windows.

    ☼  This macro works only on ordinary alphabetical characters, skipping over any numbers, keyboard symbols, punctuation, and format codes. It also skips WordPerfect symbols from the symbol sets (Insert, Symbol) — including alphabetical "characters" since they are not standard (A-Z, a-z) alpha characters, as can be seen in Reveal Codes.

    ☼  If there are any bookmarks (Tools, Bookmarks) inside the selection of text they might be relocated elsewhere in the selected area. (This is an artifact of using a new paired bookmark to delimit the text to be converted which also contains a bookmark. See the top of the macro code for how this is done.) But this should be fairly rare since the macro was designed to be used soon after incorrectly typing new text — presumably before any bookmarks might be inserted in that text.

    ☼  There are a couple of ways to help prevent the reversed-case problem in the first place:

    (1) Enable the CapsFix checkbox option in Tools, QuickCorrect, Format-As-You-Go

    - and/or -

    (2) allow the Shift key to automatically turn Caps Lock off, as was the method used back in the typewriter days. (This works in all Windows programs, including WordPerfect.) For the method see "Make the <Shift> key turn <Caps Lock> off automatically" at  http://wptoolbox.com/tips/CapsFix.html.

    [Page top]


    Footnote 1

    [This footnote was removed when the Convert Case macro included an option to capitalize the first letter of ALL words in a selection of text (i.e., in v1.02).]


    Footnote 2

    [Continued from above ....]

    ... WordPerfect stores exceptions to the rules for initial capitalization (i.e., when you use WordPerfect's Edit, Convert Case, Initial Capitals) in a normal WP file, WTNNXX.ICR (where NN is your WordPerfect version number and XX is your language version).

    Words in this file will be NOT be capitalized when the Initial Capitals (for Main Words) feature is used.

    The WTNNXX.ICR file can be edited as any other WordPerfect file to add or delete words (punctuation is ignored).

    Here's an easy way to do it:

    Exit from WordPerfect, then -

    (1) Make a copy of your WordPerfect program's .icr file to another folder [on my Windows 10 system (with WordPerfect X9) the original file is in this folder:
    C:\Program Files (x86)\Corel\WordPerfect Office X9\Writing Tools
    ].

    (2) Rename the original file (e.g., to WT19us.icr.OLD) to back it up. Note that since the original is a program file you will need administrator rights to rename it.

    (3) Open the copied file in with Windows Explorer's (right-click-on-filename) "Open with...WordPerfect...".

    (4) Modify the copied file while it's open in WordPerfect (it's just a list of words, each on a separate line).

    (5) Save this modified file with the original name (e.g., WT19us.icr).

    (6) Close WordPerfect.

    (7) Move (or copy) the modified file back into the original folder (e.g., C:\Program Files (x86)...etc.). [In Windows Explorer it should appear adjacent to the backed up version.]

    (8) Re-launch WordPerfect.

    These steps might be simplified by changing Windows permissions for the file (via its Properties) — but they work easily enough to revise the file without impacting the original.

    Note

    The Convert Case macro (see above) has the option, Initial Capitals For All The Words, which simply uses a small trick to effectively make the .ICR file invisible to the program (while the macro runs). You can view this method in the macro's code.

    An alternative macro to convert text to initial capitals for all words in a selection of text is to use this one-line macro on the selection:

    Type (ToInitialCaps (?SelectedText; FirstOfEachWord!))

    The macro will replace the text selection with the same words — but every word will be capitalized. [Thanks to Brad Robertson at WordPerfect Universe for this tip which he posted here.]

    Caution

    While this particular one-line Type(...) macro is simple and potentially useful to many users, be aware that it will remove formatting (e.g., bold, italics, etc.) from the selected text. If this is not acceptable, please consider using the Convert Case macro's
    Initial Capitals For All The Words option instead.


    Footnote 3
    [Continued from above...]

    On occasion you might apply the text (font) attribute, Small Caps, to a selection of text -- and later decide it should have been ALL CAPS. When this happens in several places or in several open documents it can be quicker to use a macro to do the job. Here's one to do the job.

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

    Note: You can remove the 3 lines of Optional code that pauses the macro at each instance found. Be sure to also remove the Label(NextOne@) command, too.
    ----------

    // Macro code begins here
    // Smallcaps2Caps.wcm - Converts all text with the Small Caps attribute to
    // all capital (UPPER case) letters.
    Display(On!) PosDocTop vCount:=0
    vSmCapsOn=NTOC(65054)  vSmCapsOff=NTOC(65055) // (<= used in SearchString)
    OnNotFound(Exit@)
    Repeat
        SearchString(vSmCapsOn)
        MatchPositionBefore()
        SearchNext
        SelectMode(On!)
        PosCharNext
        SearchString(vSmCapsOff)
        MatchExtendSelection
        SearchNext
        // -----
    Optional code:  Pause for confirmation at each item located:
            Messagebox(vAns;"";"Process this item?"; YesNoCancel!)
            If(vAns=2) Go(Exit@) Endif // (if Cancel)
            If(vAns=7) Go(NextOne@) Endif // (if No)
        // -----
        ConvertCaseUppercase
        SelectMode(Off!)
        If(?LeftCode=4083)
            DeleteCharPrevious  // (delete the paired SmCaps codes)
        Endif
        vCount:=vCount+1
        Label(NextOne@)
    Until(?NotFound)
    Label(Exit@)
    MatchSelection  // (restore to default)
    Messagebox(;"Finished!"; vCount+" items were processed.")
    Return
    // Macro code ends here


    [Page top]