![]() |
#2
|
||||
|
||||
![]()
Try:
Code:
Sub Demo() Application.ScreenUpdating = False Dim strTxt As String, i As Long strTxt = "|" With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "[A-Z]{2} [0-9]{4,}" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found If InStr(strTxt, "|" & .Text & "|") = 0 Then strTxt = strTxt & .Text & "|" Else i = i + 1 .HighlightColorIndex = wdYellow End If .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True MsgBox i & " duplicates found." End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
word table, word vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
AtaLoss | Word VBA | 37 | 09-22-2021 12:04 PM |
![]() |
rsrasc | Word VBA | 3 | 11-11-2014 03:55 PM |
Find and highlight multiple words in a document | flatop | Word VBA | 3 | 04-16-2014 10:29 PM |
Extract from String using Wildcard | whousedmy | Word | 0 | 05-21-2009 01:35 AM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |