![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Find and highlight multiple words in MS Word document
|
AtaLoss | Word VBA | 37 | 09-22-2021 12:04 PM |
Linking one word document to a 'master' word document - even if files are in private drive
|
mb3344 | Word | 2 | 08-06-2016 07:10 PM |
| Adding tables to Created word document whilst other word document open Help | rpb925 | Word VBA | 18 | 03-30-2016 04:45 PM |
Word document with Macros with trusted locatin versus Word document 1997-2003
|
Cardinal2 | Word | 1 | 11-30-2015 07:42 PM |
| Can Word highlight the same text in the Reviewing Pane as in the main document? | wordistheword | Word | 4 | 09-09-2013 04:50 AM |