![]() |
|
#1
|
|||
|
|||
|
highlight words not list in the list word vba |
|
#2
|
||||
|
||||
|
What have you tried? This isn't simply a free coding forum. You might at least start by researching other threads here for list processing.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Code:
Sub TagHighlight()
'
' TagHighlight Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "\<([A-Z]{2,4})\>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "\<([A-Z][0-9])\>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Highlight = True
With Selection.Find
.Text = "\<([A-Z]@>)\-([0-9]@>)\>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
|
|
#4
|
||||
|
||||
|
That's simply some code produced by the macro recorder to highlight:
• upper-case words of 2 to 4 characters • single capitals and numbers bounded by < & > • strings of capitals followed by numbers from which they are separated by '-' and bounded by < & > As such it does the opposite of what you describe. As I said: Quote:
https://www.msofficeforums.com/word-...ords-list.html https://www.msofficeforums.com/word-...-selected.html https://www.msofficeforums.com/word-...-document.html https://www.msofficeforums.com/word-...ord-based.html and, to include replacements: https://www.msofficeforums.com/word-...ral-items.html https://www.msofficeforums.com/word-...fractions.html https://www.msofficeforums.com/word-...-document.html https://www.msofficeforums.com/word-...ing-macro.html https://www.msofficeforums.com/word-...rk-2013-a.html https://www.msofficeforums.com/word-...sion-only.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Highlight words from a list
|
Nanaia | Word VBA | 3 | 09-07-2018 02:13 PM |
| How to find (highlight) two and more words in a list of 75k single words in Word 2010 | Usora | Word | 8 | 05-29-2018 03:34 AM |
Macro to highlight a list of words
|
bakerkr | Word VBA | 4 | 10-19-2017 02:23 PM |
Highlight Words from a Word List
|
JSC6 | Word VBA | 1 | 09-30-2014 08:22 PM |
Using macros to highlight worksheet words referenced in external list/doc.
|
Daniel_NYC | Word VBA | 1 | 04-21-2014 03:35 PM |