The article, How to spell page numbers instead of using digits in a page-numbering scheme in Microsoft Word uses page-numbering field codes and switches to display page numbers as text. You might want to do the same thing with dollar values—for instance, change 99.98 to Ninety-nine and 98/100. To do so, you can use a blank field and two formatting switches. In this article, I’ll show you these switches so you can put them to work in your own documents.
SEE: 83 Excel tips every user should master (TechRepublic)
I’m using Microsoft 365 on a Windows 10 64-bit system, but you can use earlier versions. (I recommend that you not upgrade to Windows 11 until all the kinks are ironed out—unless you have a specific reason to do so.) Word fields aren’t supported by Word Online; the original values will display, but they won’t update, nor can you insert them. For your convenience, you can download the .doc and .docx demonstration files.
Field basics in Microsoft Word
This article assumes that you understand Word fields–how to insert them, how to refer to them, and how to update them. If you aren’t familiar with Word fields, you might want to read 3 ways to enter fields in Microsoft Word first. However, I will provide basic instructions in this article so you should be able to follow these instructions to success without reading another article.
A Word field is a set of instructions that produce very specific results. It’s like a macro or procedure, but it’s built-in and all you have to do is insert it and provide additional information, when required. Switches are used to include additional information or formatting.
There are three ways to insert a field, and you should use the method you’re most comfortable with throughout this article:
- Use the interface
- Ctrl + F9
- Type and convert
I’ll use the Ctrl + F9 method.
This case is a bit unusual because there’s no field code. Instead, you insert a blank field, a value and switches. There’s no instruction code; this is all about formatting with switches.
The switches in Word
To convert a dollar amount into the appropriate text, we’ll work with two switches: \*DollarText and \*FirstCap.
The first switch, \*DollarText displays a referenced numerical value as text. If the value has a decimal value, the switch adds “and” at the decimal place and displays the first two decimals (rounded) as a fraction. It displays everything in lowercase letters.
To enter this field, do the following:
- Press Ctrl + F9 to enter a pair of code brackets.
- Enter the following, =99.98 \*DollarText, inside the brackets (Figure A).
- Press Shift + F9 to convert the field into the results shown to the right in Figure A.
Remember earlier when I said there’s no code? You entered a numeric value and a switch, and that’s it. For this reason, this use is a bit unusual, but it isn’t wrong. There’s no code, only a value that you supply.
The second switch, \*FirstCap, converts the first letter in the resulting string to uppercase (or sentence case). You can include both switches when you create the field, but I want to show you how to modify a field instead. First, press Shift + F9 to convert the string to the underlying field. Then, enter the following switch, \*FirstCap after the first switch and before the closing bracket, as shown in Figure B. Press Shift + F9 to see the results shown to the right of Figure B. If the field fails to update, right-click it and choose Update Field.
There is a limitation with this field; have you noticed it yet? The resulting text doesn’t include the word dollar(s): Ninety-nine dollars and 98/100. Depending on how you use this field, you might be able to ignore this omission. I know that I never bother to write in dollars on the rare occasion when I write a check. If it does matter, a field fix would be so daunting that I would recommend a VBA procedure instead.
Sentence case isn’t the only case switch you can use. Let’s quickly review the remaining.
More case sensitive switches
At this point, you might have everything you need. However, there are other case switches. You’ll use them the same way, replacing \*FirstCap with one of the following:
- \*Caps: Converts the first letter of each word to uppercase.
- \*Upper: Convers all letters to uppercase.
- \*Lower: Converts all letters to lowercase.
Our example used a static numeric value, 99.98, to convert into text using a word field. You can also use a bookmarked value, creating a more dynamic solution. I’ll show you how to do this in a future article.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays