In this month's Q&A, Susan Harkins shows a reader two simple techniques for repeating text in Word.
A frequent reader question involves repeating text in a Word document. For example, Yassen wants to populate a combo box content control with three items. When users select an item from the control's dropdown list, Word should repeat the selected value throughout the document.
Spend any time researching repeated content, and you'll probably come across some difficult solutions, from mapped XML elements to bookmarked controls and form fields. If you're an ordinary user without advanced skills, you're out of luck. Fortunately, there are two ways to display repetitive data that don't require any expert skills.
I'm using Word 2016 (desktop) on a Windows 10 64-bit system, but both techniques will work in older versions. The browser edition doesn't support content controls. You can't insert fields in the browser edition, but it will support them, to a degree. You won't see the field's results on screen, but Word will print them. There's no downloadable demonstration file, because you won't need one.
SEE: 50 time-saving tips to speed your work in Microsoft Office (free TechRepublic PDF)
The example content control
We'll look at two methods to achieve Yassen's goal, using the same example combo box content control in both:
- Position the cursor where you want to insert the content control and click the Developer tab. If this tab isn't available, and you don't know how to add it to the Ribbon, read Two easy ways to customize the Ribbon interface.
- In the Controls group, click the Combo Box Content Control to insert the control.
- Click Properties in the Controls group.
- Enter a meaningful title (name) for the control in the Content Control Properties dialog.
Now, you need to create the items that will populate the control's dropdown list:
- Click Add.
- In the resulting dialog, enter the first item, Public. Then, enter the value 1 (Figure A) and click OK.
- Repeat those steps to add two more items: Internal, 2 and Confidential, 3. Figure B shows all three items.
Add an item to the dropdown list.
This dropdown will have three items.
Figure C shows the control with its populated dropdown list. In this example, we won't use the values you used to define each item for the dropdown list, but we entered them in case you want to further customize yours. (The values are accessible via VBA.)
Word populates the control's dropdown list with the three items you added.
SEE: 20 pro tips to make Windows 10 work the way you want (free TechRepublic PDF)
A copy and paste method
Now you need to paste the control into the areas where you want the selected confidentiality level to repeat. This is the tricky part because if you don't select the control properly, Word won't let you paste it as a link, and that's what you need--a link.
To select the control, double-click it. If it's aligned with the left margin, you can also click to the left in the margin. Press Ctrl+C to copy the control to the Clipboard. Position the cursor where you want to repeat the control's selected value. Don't press Ctrl+V as you normally would to paste something. Instead, choose Paste Special from the Paste dropdown in the Clipboard group on the Home tab (Figure D).
Choose Paste Special; don't use Ctrl+V.
In the resulting dialog, select the Paste Link command to the left, select the Unformatted Text option in the As list, as shown in Figure E, and then click OK. If the Paste Link option is disabled, exit out of the dialog, reselect the control, copy it, and try again.
Paste the control as an unformatted link.
Yassen wants the repeated text in the document's footer, which Word supports. Simply open the footer and paste the control. Figure F shows the copied control in the body of the document a few lines below the original and in the document's footer.
This document will repeat the selected value in the original control in the body of the document and in the footer.
The only thing left to do is to choose an item from the original control's dropdown list and watch the other two controls update automatically. If you're still in edit mode for the footer, exit out. Next, click the Confidentiality Levels dropdown and select Public (or any other item). Both copied controls update immediately--even the one in the footer, as shown in Figure G.
The copied controls repeat the selected value.
When you open the file, Word will prompt you about the link. Click Yes; if you click No, your copied controls won't update if you change the selected value in the original control.
You don't need specialized development skills or even power-user confidence to make this work. If you can copy and paste, your document can support repetitive data.
StyleRef is a reference field that automatically displays specifically styled text. In this example, we won't copy and paste the control as we did before. Instead, we'll apply a style and then insert a StyleRef field where we want to repeat the text. Unfortunately, this field looks for and displays the closest text formatted using the specified style--so it's not quite as powerful as the linked solution.
First, apply a style to the original example control. Choose one that's not currently in use; you must use a unique style. You can modify the style to meet your formatting needs or create a new style. In this example, we'll use the built-in Subtitle style. Simply select the control and click Subtitle in the Styles gallery (Figure H).
Apply a style to the control.
Now you're ready to insert the fields as follows:
- Position the cursor where you want the text to repeat.
- Click the Insert tab.
- Choose Field from the Quick Parts dropdown in the Text group.
- In the resulting dialog, choose StyleRef from the Fields Name list.
- From the Style Name list, select Subtitle (Figure I).
- Click OK to insert the field.
Choose the same style you applied to the control.
As you can see in Figure J, I added two StyleRef fields: one below the original control and one in the header. Unfortunately, this field looks for and displays the closest text formatted using the specified style (from the top of the page), so it's not quite as powerful as the linked solution. However, you can change the default and force Word to search from the bottom of the page.
StyleRef works with only one field.
Send me your question about Office
I answer readers' questions when I can, but there's no guarantee. Don't send files unless requested; initial requests for help that arrive with attached files will be deleted unread. You can send screenshots of your data to help clarify your question. When contacting me, be as specific as possible. For example, "Please troubleshoot my workbook and fix what's wrong" probably won't get a response, but "Can you tell me why this formula isn't returning the expected results?" might. Please mention the app and version that you're using. I'm not reimbursed by TechRepublic for my time or expertise when helping readers, nor do I ask for a fee from readers I help. You can contact me at email@example.com.
- Microsoft Certified Engineer 27-Course Super Bundle: Lifetime Access (TechRepublic Academy)
- Microsoft adds more business apps to Office 365 Business Premium subscriptions (ZDNet)
- Five ways to take advantage of Excel list features (TechRepublic)
- Office Q&A: A conditional formatting rule with multiple conditions (TechRepublic)