1

In Microsoft Word, is it possible to create a cross-reference that shows the heading number in another document?

I created a sample source document with a numbered heading and saved it. Then, in my destination document, I created a cross-reference to a heading to get the name of the auto-generated bookmark for the heading. This cross-reference shows 1.0, the heading number. Then, I used {Includetext c:\directory\subfolder\source.docx _Ref429731814}

The problem is, this pulls in the heading text (actually only the first word of the heading text) rather than the heading number. Is there a way to get the number?

1 Answer 1

2

Yes, but you have to introduce another bookmark in the source document and the result won't behave the same as a normal hyperlinked reference.

Create your cross-reference in the source document. That should create a field something like this:

{ REF _Ref303672260 \r } (There may be a \h in there as well)

Select that field and insert another pair of field codes around it (e.g. using ctrl-F9 on Windows versions of Word. So you have

{ { REF _Ref303672260 \r } }

Then type "SET myref" after the initial { so you have:

{ SET myref { REF _Ref303672260 \r } }

(Choose a suitable name instead of "myref".) Select those nested fields and update them. There should be no visible result. In the target document, use

{ INCLUDETEXT "c:\\directory\\subfolder\\source.docx" myref }

As a final observation, some types of eidt to the source document may destroy the _Ref bookmark - e.g. if you delete the referenced paragraph and re-insert it. In that case you will need to insert a new cross-reference in the source document and use that to modify the _Ref name in your nested field (Or recreate the nested field). Alternatively, you can insert your own bookmark name (say "_mymark") somewhere in the paragraph you want to reference, and use that, so you have

{ SET myref { REF _mymark \r } }

i.e. the bookmark name does not have to be system-generated for the \r switch to work.

1
  • Awesome! This worked perfectly, with one small change. I needed to use \\ rather than \ in the file path. (I requested that as an edit to your answer.) Commented Sep 14, 2015 at 12:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .