# Repeating Text throughout a doc



## music_al (Jan 12, 2009)

Im running Word 2007 and I want to enter a piece of text into a word document ONCE and for it to be repeated automatically any number of times within the same document.

In particular I want to enter a piece of text in a table cell and for that text within a particular cell to appear in the header (or footer)

How do I do this ?

Thanks in advance

Allan


----------



## Macropod (Jan 16, 2009)

Hi Allan,

Format the text in a Style that isn't in use for anything else, then use a STYLEREF field referring to that Style in the page header.

Cheers


----------



## music_al (Jan 16, 2009)

Hi Macropod

I think you may have misunderstood what I am trying to do.

Imagine if I have a Template Document that is used over and over by different users. If within this template I have a 5 digit numerical field called "document_ref_number", rather than type the actual number (56789) over and over within the document, I just want to enter it once and for the number to be updated throughout the document automatically.

I wasnt referring to styles.

Thank you

Allan


----------



## Marbles (Jan 16, 2009)

You could try Bookmarks, and fields referencing the Bookmark.


----------



## Macropod (Jan 16, 2009)

Hi Allan,

I understood the specification perfectly well:





> In particular I want to enter a piece of text in a table cell and for that text within a particular cell to appear in the header (or footer)



If you want to repeat the # in the header, then using a particular Style for the paragraph concerned, and a STYLEREF field in the header is the simplest - and most reliable - way to do it. The problem with using bookmarks, as suggested by Marbles, is that they're all too easily deleted - plus they don't update until you preview or print the document 

You've now said you have a 5-digit numerical field called "document_ref_number"? What is this 'field'? A formfield in a document protected for forms? A custom document property?

If its a formfield, you can still use the STYLEREF approach, or you can make sure the formfield properties are set to 'calculate on exit' then insert a cross-reference in the header to the formfield's bookmark name.

If it's a custom document property, then insert a DOCPROPERTY field in the header to retrieve the property's value.

Cheers


----------



## AMads (Mar 4, 2009)

Thank you very much Macropod 

I found your tip after two hours of experimenting, reading help and googling. I was just about to give up 




To elaborate:
Give the text a style that will not be used for anything else. E.g. 'MyUniqStyleReff'.
Place the curser where you want the first copy to be.
Insert a styleref field:
Choose the command Insert, Field
Categories: Links and References
Field names: StyleRef
Style name: E.g. 'MyUniqStyleReff'​The result, when showing codes, will be something like this:
{ STYLEREF MyUniqStyleReff \* MERGEFORMAT }

The problems with alternatives:
Cell references: Can only "copy" numbers. Not text. At least I have not found a way.
Bookmarks: The bookmark is easily deleted when overwriting.

Thanks again 
Anders


----------

