Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-23-2021, 04:44 AM
DRD992 DRD992 is offline Macro to Find & Highlight Words from List Windows 7 64bit Macro to Find & Highlight Words from List Office 2013
Novice
Macro to Find & Highlight Words from List
 
Join Date: Jan 2016
Posts: 11
DRD992 is on a distinguished road
Default Macro to Find & Highlight Words from List


Thank you, Macropod!
Reply With Quote
  #2  
Old 02-25-2023, 09:16 AM
Themillen Themillen is offline Macro to Find & Highlight Words from List Windows 11 Macro to Find & Highlight Words from List Office 2021
Novice
 
Join Date: Feb 2023
Posts: 4
Themillen is on a distinguished road
Default

I used the macro below you provided in this chat and it works, thanks! However, would it be possible to limit it to the text I selected in the active document only? The seperate document has 2000 words, so if the active document has too mucht text it will ages... Even though I might only want to scan like 100 words to be highlighted. If anyone can help, much appreciated!



Sub B2_Highlighter_Selection_andAllWordForms()
Application.ScreenUpdating = False
Options.DefaultHighlightColorIndex = wdBrightGreen
Dim FRDoc As Document, FRList, i As Long
Set FRDoc = Documents.Open("C:\path.docx", ReadOnly:=True, Addtorecentfiles:=False, Visible:=False)
FRList = FRDoc.Range.Text: FRDoc.Close False: Set FRDoc = Nothing
With Selection.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchWholeWord = True
.MatchCase = False
.Replacement.Text = "^&"
.Replacement.Highlight = True
'Process each word from the List
For i = 0 To UBound(Split(FRList, vbCr)) - 1
.Text = Split(FRList, vbCr)(i)
.Execute Replace:=wdReplaceAll
Next
End With
Application.ScreenUpdating = True
End Sub
Reply With Quote
Reply

Tags
find, highlight, macro

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Find & Highlight Words from List highlight words not in list karkey Word VBA 3 01-05-2021 02:13 PM
Macro to Find & Highlight Words from List Macro To Identify & Highlight Words In MS Word Based Upon A List In Excel File Column abhimanyu Word VBA 5 03-20-2020 01:33 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 Find & Highlight Words from List Macro to highlight a list of words bakerkr Word VBA 4 10-19-2017 02:23 PM
Macro to Find & Highlight Words from List Find and highlight all words ending in -ly RBLampert Word VBA 13 10-23-2012 04:45 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:08 PM.


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