View Single Post
 
Old 10-28-2016, 01:24 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could use Word's 'comment' tool to add the explanatory text. For example:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim FRDoc As Document, strFnd As String, strRep As String, i As Long
Set FRDoc = Documents.Open("Drive:\FilePath\FindTableData.doc", _
  ReadOnly:=True, AddToRecentFiles:=False, Visible:=False)
For i = 1 To FRDoc.Tables(1).Rows.Count
  strFnd = Split(FRDoc.Tables(1).Cell(i, 1).Range.Text, vbCr)(0)
  strRep = Split(FRDoc.Tables(1).Cell(i, 2).Range.Text, vbCr)(0)
  With ActiveDocument.Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Format = False
      .MatchCase = True
      .MatchWholeWord = True
      .MatchWildcards = False
      .Wrap = wdFindStop
      .Text = strFnd
      .Execute
    End With
    Do While .Find.Found
      .HighlightColorIndex = wdBrightGreen
      .Comments.Add .Duplicate, strRep
      .Collapse wdCollapseEnd
      .Find.Execute
    Loop
  End With
Next
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote