![]() |
|
#2
|
||||
|
||||
|
Try:
Code:
Sub TabulateKeyTerms()
Application.ScreenUpdating = False
Dim Doc As Document, RefDoc As Document, Rng As Range
Dim StrTerms As String, strFnd As String, StrPages As String
Dim r As Long, j As Long, StrOut As String, StrBreak As String
Set Doc = ActiveDocument
Set RefDoc = Documents.Open("Drive:\FilePath\KeyTerms.doc", ReadOnly:=True, AddToRecentFiles:=False)
For r = RefDoc.Tables(1).Rows.Count To 1 Step -1
strFnd = Trim(Split(RefDoc.Tables(1).Cell(r, 1).Range.Text, vbCr)(0))
With Doc.Content
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Format = False
.Text = strFnd
.Wrap = wdFindStop
.MatchWholeWord = True
.MatchWildcards = False
.MatchCase = True
.Execute
End With
If .Find.Found = False Then RefDoc.Tables(1).Rows(r).Delete
Next r
Set Rng = Doc.Range.Characters.Last
Rng.FormattedText = RefDoc.Tables(1).Range.FormattedText
RefDoc.Close False
Set Rng = Nothing: Set RefDoc = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Creating sidebar (or wide margin) for glossary items
|
almagary | Word Tables | 3 | 01-23-2018 04:34 PM |
Best Practice for Indexing Multiple Word Terms and Sub-Terms
|
jhy001 | Word | 4 | 11-06-2017 02:08 PM |
| Auto Generation of Hyperlinks | cooloox | Excel Programming | 4 | 03-27-2017 06:47 AM |
Keyboard shortcut for glossary styles
|
Jennifer Murphy | Word | 1 | 01-06-2016 09:19 AM |
Invoice Number Generation
|
mrphilk | Excel | 2 | 06-08-2010 12:39 PM |