Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Durham, North Carolina, USA
    Posts
    140
    Thanks
    5
    Thanked 1 Time in 1 Post

    Finding things NOT a field (WXP)

    Howdy folks,

    I'm a proofreader/editor, and one of things I have to find is instances where references to Tables or Figures are NOT cross-referenced properly--in other words, find cases where the word "Table" (or "Figure") is NOT a field.

    Anyone got some code to do this?

    Thanks,

    Beej

  2. #2
    3 Star Lounger
    Join Date
    Apr 2004
    Location
    Boston, Massachusetts, USA
    Posts
    389
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Finding things NOT a field (WXP)

    Not the speediest, but it works:

    <pre>Sub FindTablesAndFiguresNotInFields()
    Dim doc As Document
    Dim para As Paragraph
    Dim wrd As Range
    Set doc = ActiveDocument
    For Each para In doc.Paragraphs
    With para.Range.Find
    .ClearFormatting
    .MatchCase = True
    .MatchWildcards = True
    .Text = "[TF][ableigur]{4,5}"
    If .Execute Then
    For Each wrd In para.Range.Words
    If Trim(wrd) = "Table" Or _
    Trim(wrd) = "Figure" Then
    If wrd.Fields.count = 0 Then
    wrd.HighlightColorIndex = wdBrightGreen
    End If
    End If
    Next wrd
    End If
    End With
    Next para
    End Sub
    </pre>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •