Microsoft Word: Character reference

By J. Carlton Collins, CPA

Q: Our company uses Word to generate timely web content, which then automatically flows to numerous internet forms for mass distribution. Most of the forms we link to limit the maximum number of characters. Is there an easy way to automate an operation to display word counts on the Word document—perhaps with a macro or VBA code?

A: (While this question is highly specific, my proposed solution regarding calculated fields in Word has numerous general applications that may benefit many readers.) You can display a document's character count in the header by inserting a calculating field into the Word header as follows: Double-click the header area to access the header, press Ctrl+F9 to insert a set of field braces, type = (the equal sign), press Ctrl+F9 again to insert another set of field braces, and then type numchars. At this point, your calculating field should appear as follows:

{={ numchars }}

With the cursor still positioned on the calculating field, press F9 to calculate (or update) the field; this action will display the total number of characters at the top of every page in the Word document.

To further improve on this solution, you could record this operation as a macro and create a macro button that automatically inserts this calculating field into any document's header as follows. From the View tab, select Macros, Record Macro, enter a name for the macro such as Insert_Character_Count as pictured below, and click OK.

techqa-4


From the Insert tab, select Header, Edit Header, press Ctrl+A to select all header content, press the Delete key to delete all header content, press Ctrl+F9 to insert a set of field braces, type = (the equal sign), press Ctrl+F9 again to insert another set of field braces, type numchars, press the F9 key, from the Insert tab, select Close Header and Footer, and then from the View tab, select Macros, Stop Recording. To make your new macro more accessible, add it to the Quick Access Toolbar by right-clicking the toolbar, select Customize Quick Access Toolbar, in the resulting Word Options dialog box, select Macros from the Choose commands from dropdown box, select the newly created macro (as pictured below), click the Add button to include this macro on the toolbar, click the Modify button and change the macro icon and title (in this example I've used the smiley face icon and labeled the macro Add Character Count to Document), and then click OK.

techqa-5

 

Thereafter, clicking the smiley face macro icon from the toolbar automatically inserts the character count in the document's header and will also update the character count, as pictured below.

You can download an example macro-enabled Word 2013 document that contains this macro at carltoncollins.com/character.docm. Notes: (1) Be sure to add text to this sample Word document so you can see the results update with a new character count; (2) your Quick Access Toolbar will not automatically display this macro button until you add the macro to the toolbar; or, if you prefer, you can run the macro from the View tab, by selecting Macros, View Macros, select the Insert_Char_Count macro and then click Run.

techqa-6

 

About the author

J. Carlton Collins (carlton@asaresearch.com) is a technology consultant, a CPE instructor, and a JofA contributing editor. Note: Instructions for Microsoft Office in “Technology Q&A” refer to the 2013, 2010, and 2007 versions, unless otherwise specified.

Submit a question

Do you have technology questions for this column? Or, after reading an answer, do you have a better solution? Send them to jofatech@aicpa.org. We regret being unable to individually answer all submitted questions.

SPONSORED REPORT

Cybersecurity threats proliferating for midsize and smaller businesses

This report details how SMBs can properly protect private information from breaches, design and implement a cybersecurity policy, and create safeguards for training and education.

CHECKLIST

Being responsive to clients

CPAs and their firms have daily pressures and hectic schedules, but being responsive is crucial to client satisfaction. Leaders in the profession offer advice for CPA firms that want to be responsive to clients.

QUIZ

Test yourself on these often confused words

The spelling checker on your word processing program can do only so much to flag problems. Your best insurance is to learn the troublesome words that trip up writers and use them correctly by the standards of formal, written English.