Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Abbreviations and Acronyms Table - Auto Compile

Status
Not open for further replies.

MeGustaXL

Technical User
Aug 6, 2003
1,055
GB
Big document - over 150 pages - with LOADS of Acronyms and Abbreviations. Table at the end listing them all. How can I make sure I get every initial (no pun intended) occurrence of an abbreviation and put it in the table? Also, check the other way, to make sure every abbreviation defined in the table is in the document.

Chris

Someday I'll know what I'm donig...damn!

 
Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim RngDoc As Range, oTbl As Table, strFnd As String, i As Long
With ActiveDocument
  Set oTbl = .Tables(.Tables.Count)
  Set RngDoc = ActiveDocument.Range
  RngDoc.End = oTbl.Range.Start
  For i = 2 To oTbl.Rows.Count
    With oTbl.Cell(i, 1).Range
      strFnd = Left(.Text, Len(.Text) - 2)
    End With
    With RngDoc
      With .Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Format = False
        .Text = strFnd
        .MatchWholeWord = True
        .MatchWildcards = False
        .MatchCase = True
        .Execute
      End With
      If .Find.Found = True Then
        oTbl.Cell(i, 2).Range.Text = .Information(wdActiveEndAdjustedPageNumber)
      End If
    End With
  Next
End With
Application.ScreenUpdating = True
End Sub
The code assumes the acronyms are in the first column and the initial page # is to appear in the second column.

As for the second problem, you might try something based on the discussion starting at:
Cheers
Paul Edstein
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top