Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 06-17-2023, 05:06 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

If anyone can find the time, do you know how I can change this macro below from making the selected text bold to higlight red? Simply change it to ".Replacement.HighlightColorIndex = wdRed: .Replacement.Highlight = True" doesn't word for some reason. Thanks for your time!



Sub LinkingWords_SelectedText_Bold()
Dim vWords As Variant
Dim sWord As Variant

' Split the words into smaller arrays
vWords = Array( _
Array("in spite of", "while", "whereas", "though", "admittedly", "regardless"), _
Array("So", "To summarize", "On the other side", "In conclusion", "Lastly", "In conclusion", "In short"))


' Process each sub-array separately
For Each subArray In vWords
For Each sWord In subArray
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Bold = True
With Selection.Find
.Text = sWord


.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next sWord
Next subArray
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 06:26 AM.


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