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

How to make the most of a negotiation

Negotiators are made, not born. In this sponsored report, we cover strategies and tactics to help you head into 2017 ready to take on business deals, salary discussions and more.

VIDEO

Will the Affordable Care Act be repealed?

The results of the 2016 presidential election are likely to have a big impact on federal tax policy in the coming years. Eddie Adkins, CPA, a partner in the Washington National Tax Office at Grant Thornton, discusses what parts of the ACA might survive the repeal of most of the law.

QUIZ

News quiz: Scam email plagues tax professionals—again

Even as the IRS reported on success in reducing tax return identity theft in the 2016 season, the Service also warned tax professionals about yet another email phishing scam. See how much you know about recent news with this short quiz.