![]() |
#3
|
|||
|
|||
![]()
Ok, here it comes:
Code:
Sub HighlightRanges() Dim doc As Document: Set doc = ActiveDocument Dim SRange As Range: Set SRange = doc.Range Dim RePaintText As Variant Dim i As Long RePaintText = Array("Pos.", "Wert", "077.0087") Application.ScreenUpdating = False ClearFindnReplace Options.DefaultHighlightColorIndex = wdViolet With SRange.Find .Text = "Pos.*Wert" .Replacement.Highlight = True .MatchWildcards = True .Execute Replace:=wdReplaceAll End With ClearFindnReplace Options.DefaultHighlightColorIndex = wdYellow With SRange.Find .Replacement.Highlight = True For i = LBound(RePaintText) To UBound(RePaintText) .Text = RePaintText(i) .Execute Replace:=wdReplaceAll Next i End With End Sub Sub ClearFindnReplace() With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = "" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With End Sub As I wrote, works fine, but ignores tables. Thanks NP |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Change characters outside a wildcard while keeping wildcard results | nymusicman | Word VBA | 2 | 04-10-2014 08:17 AM |
![]() |
NobodysPerfect | Word | 10 | 03-19-2014 04:29 AM |
![]() |
omtinole | Excel Programming | 1 | 07-13-2012 10:03 PM |
![]() |
Sachelis | Word | 2 | 01-28-2011 08:50 AM |
Wildcard search help. | Kempston | Word | 0 | 11-13-2009 03:58 AM |