Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

How To use Data from a form field in word as a document footer.

I am working on building a template document for reports.
On the cover of the report, We have a space to enter title and a date

These fields were created using Rich Text Controls in the Design Mode under Developer.

The fields are called title and date.

I would like the information the staff member enters on the cover page to populate the footer on subsequent pages with whatever was entered into the form fields on the cover page.

Is there a way to do this? If so, how?
2 Solutions
One way to do that is to use a macro. Place two text boxes in the footer (Developer Tab - Control Box - ActiveX Controls - Text Box). Go to the visual basic editor (Alt+f11), highlight "This Document" and select View Code. Paste in the following:

Sub UpdateFields()
  Me.TextBox1.Value = ActiveDocument.ContentControls(1).Range
  Me.TextBox2.Value = ActiveDocument.ContentControls(2).Range
End Sub

You may have to modify the ContentControls numbers (1) to match your title and date fields.
Another way would be to use StyleRef fields.

Create two new styles from the current style of each Content Control, e.g. Styel1 & Style2, Set the style of each control to one of each style.

In the footer, place two StyleRef fields (Insert tab, Text group, Quick Parts dropdown, Field... Item) and set each StyleRef field to refer to the relevant style.
itkadminAuthor Commented:
Both solutions worked. I went with the second one as it doesn't use macros. I liked the first better because it provides more control, but it uses macros. The problem with that is some staff use the online version of word which doesn't work well with macros and some staff were thrown off by having to enable macros in a document.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now