Share via

Find cross-reference = "0"

Anonymous
2022-06-02T09:34:39+00:00

Hello all,

I am often working on large documents with many cross-references (to numbered sections, tables, figures, etc). Sometimes, I inadvertently break a cross-reference, e.g. the hidden bookmark expands to include an unnumbered paragraph, causing the cross-reference to show a "0", instead of the numbered section (see screenshot below). I know how to prevent these mistakes but unfortunately, it still happens sometimes.

Is there a way to search the document for these "0", without having to proofread the whole document? I'm looking for a solution to search only "0" in fields (or field codes, or field shading), simply searching for "0", "0.", " 0" is not a preferred way, because this will also result in many many "flat text numbers" search results that I will have to weed through.

Any suggestions?

Screenshot:

BR,

J

Microsoft 365 and Office | Word | For business | 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

Jay Freedman 207.7K Reputation points Volunteer Moderator
2022-06-02T16:29:00+00:00

If you don't mind running a macro (see https://www.gmayor.com/installing_macro.htm if needed), the following one will locate the first Ref field in the document that displays a result of 0. (Cross-references are Ref fields.) The field will be selected and the macro will stop. After you fix that reference, run the macro again to find the next one if any remain.

Sub FindRefTo0() 

    Dim fld As Field 

    For Each fld In ActiveDocument.Fields 

        If fld.Type = wdFieldRef And fld.Result = "0" Then 

            fld.Select 

            Exit Sub 

        End If 

    Next fld 

    MsgBox "No more 0 references" 

End Sub

Was this answer helpful?

4 people found this answer helpful.
0 comments No comments

4 additional answers

Sort by: Most helpful
  1. Stefan Blom 342.6K Reputation points MVP Volunteer Moderator
    2022-06-02T09:51:28+00:00

    If the cross-reference is hyperlinked, you can click (or Ctrl + click) it to find the target, even though the numbering is broken.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2022-06-03T07:58:34+00:00

    Thank you Jay! This is exactly what I need!

    Was this answer helpful?

    0 comments No comments
  3. Stefan Blom 342.6K Reputation points MVP Volunteer Moderator
    2022-06-02T12:55:29+00:00

    I misunderstood your initial question.

    Selecting the option "Find whole words only" in the Find and Replace dialog box (Ctrl+H) seems to find only single-digit zeros.

    Of course, this would also find single zeros that are not cross-references (REF fields). So it isn't a very elegant solution.

    Image

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2022-06-02T11:51:54+00:00

    Hi Stefan,

    The problem is not finding the target of the crosslink, but finding these "0" that can be "hidden" in the verbiage of these lengthy documents. Once I find them, I have no problem repairing them.

    Was this answer helpful?

    0 comments No comments