Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-05-2021, 05:55 AM
karkey karkey is offline highlight words not in list Windows 10 highlight words not in list Office 2013
Novice
highlight words not in list
 
Join Date: Jan 2021
Posts: 19
karkey is on a distinguished road
Default highlight words not in list

highlight words not list in the list word vba
Reply With Quote
  #2  
Old 01-05-2021, 06:52 AM
macropod's Avatar
macropod macropod is offline highlight words not in list Windows 10 highlight words not in list Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 01-05-2021, 07:14 AM
karkey karkey is offline highlight words not in list Windows 10 highlight words not in list Office 2013
Novice
highlight words not in list
 
Join Date: Jan 2021
Posts: 19
karkey is on a distinguished road
Default

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
I tried Paul for highlight
Reply With Quote
  #4  
Old 01-05-2021, 02:13 PM
macropod's Avatar
macropod macropod is offline highlight words not in list Windows 10 highlight words not in list Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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:
You might at least start by researching other threads here for list processing
For example:
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]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
highlight words not in list 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
highlight words not in list Macro to highlight a list of words bakerkr Word VBA 4 10-19-2017 02:23 PM
highlight words not in list Highlight Words from a Word List JSC6 Word VBA 1 09-30-2014 08:22 PM
highlight words not in list Using macros to highlight worksheet words referenced in external list/doc. Daniel_NYC Word VBA 1 04-21-2014 03:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft