0

I have a large word document with multiple cross-references to figures, tables etc.

How can I add a page number to these references?

So, for example, "See Table 2" would become "See Table 2 (p. 123)".

Is this possible? Perhaps with a Macro or VB script?

2

I don’t know of any way to make a single, unified cross-reference that includes both a label&number (e.g., Table n, Figure n, or Equation n) and also a page number — but you can certainly do it with two separate cross-references to the same item/caption:

       

I spent five minutes recording a macro to take a “Figure n” reference and add “ (page num)”:

Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Copy
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" (page "
Selection.PasteAndFormat (wdFormatOriginalFormatting)
Selection.TypeText Text:=")"
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.MoveLeft Unit:=wdCharacter, Count:=4
Selection.MoveRight Unit:=wdCharacter, Count:=8
Selection.MoveLeft Unit:=wdCharacter, Count:=3
Selection.TypeText Text:="PAGE"
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Fields.Update

Just insert your “Figure n” cross-reference and run the above.  It

  • copies the reference you just created,
  • inserts “ (page ”,
  • pastes the cross-reference,
  • inserts “)”,
  • moves back (to the left) and selects the cross-reference, and
  • edits the cross-reference, changing REF to PAGEREF.

I expect that this will work equally with Tables and Equations, and (possibly with some modifications) with section headings.

  • It would not traverse the whole document though, would it? I guess it could be possible to write a macro based on this which goes through the whole document and changes Figure, Equation and Table references.. – Asu May 6 '15 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.