Share via

Field Code for StyleRef

Anonymous
2013-10-10T14:22:48+00:00

What is the correct way to insert a field code based on a style? For example, I have a date and a version # on the cover page of document that  I want to appear in the footer of the pages in that document (so when I update the cover, it will update in the footer). I created a style for the date and created a style for the version #. In the footer, when I Insert_QuickParts_Field_**STyleRef (**Style name): and select the style, I get the following: Error! No text of specified style in document.

What am I not doing correctly?

Thank you.

I think I just figured out what the problem is. The styles on the cover were in a drawn text box. When I took them out of the text box and put them on the page, the field codes appeared in the footer. This doesn't make sense, since the styles are still valid, whether in a box or loose on the page. Maybe a fix patch is needed in Word for this issue.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Suzanne S Barnhill 278.1K Reputation points MVP Volunteer Moderator
2013-10-11T13:04:57+00:00

In Word 2003 and earlier, text in text boxes was "invisible" to Word for many purposes (such as creating cross-references and TOCs), but I wasn't aware that this affected StyleRef fields. In any case, in Word 2007 this problem was eliminated for cross-references and TOCs, and I can't imagine that that wouldn't apply to StyleRef fields as well. However, I can reproduce your issue in both Word 2003 and Word 2010.

What Word 2007 and above seem to prefer to use for the purpose you describe, however, is mapped content controls (see #7 in http://gregmaxey.mvps.org/word_tip_pages/repeating_data.html); a simpler solution that might do just what you need is to use a frame instead of a text box. In Word 2003, the Format Text Box dialog has a "Convert to frame" option; unfortunately that's no longer available in Word 2007 and above. But you can draw a frame in the same way you drew the text box; the Insert Frame command is in the Legacy Forms palette of the Legacy Tools in the Controls group on the Developer tab, but you can also add the button (Insert Horizontal Frame) to the QAT is you use it frequently.

By default the frame (like the text box) will have a border; unlike the text box, which has a Shape Outline, the frame has an ordinary border, which can be removed with the No Border button on the Borders dropdown in the Paragraph group of the Home tab.

Was this answer helpful?

0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-10-11T15:15:16+00:00

    Thank you, Suzanne. I just did a test on your instructions and it worked. So good to have this information. Very useful to me in the work I do.

    Much appreciated, Irene

    Was this answer helpful?

    0 comments No comments
  2. Suzanne S Barnhill 278.1K Reputation points MVP Volunteer Moderator
    2013-10-11T12:49:44+00:00

    This is really quite unnecessary. There is no reason not to discuss fields in this forum.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-10-11T12:37:00+00:00

    Thank you for the suggesstion, Guruprasad Ra. :-)

    Irene

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-10-11T05:46:31+00:00

    Hi Irene,

    Since you are trying work with the Field codes in the Word, you may also post the question in the following link for the better suggestions:

    http://social.technet.microsoft.com/Forums/office/en-US/home?forum=word

    Thank you.

    Was this answer helpful?

    0 comments No comments