Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-27-2023, 08:21 AM
syl3786 syl3786 is offline VBA Code to remove specific highlight Windows 10 VBA Code to remove specific highlight Office 2019
Advanced Beginner
VBA Code to remove specific highlight
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Highlight = True
    While .Execute
      Select Case oRng.HighlightColorIndex
        Case Is = 9999999
          oRng.HighlightColorIndex = wdAuto
      End Select
      oRng.Collapse wdCollapseEnd
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
Thank you gmaxey! It is very useful. MayI ask if this macro can just remove the one of the selected highlight colours but not remove all of them? Now it just remove texts with two highlighted colors combined and remove those combination.
Reply With Quote
 

Tags
highlight, macro, word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Code to remove specific highlight VBA Highlight numbers only after or before specific words help Shelley Lou Word VBA 12 08-09-2022 03:02 AM
VBA Code to remove specific highlight Remove highlight with specific color rekent Word VBA 2 08-01-2020 10:59 AM
How to highlight lines containing specific words SixStringSW Word VBA 4 06-03-2018 03:57 PM
VBA to highlight specific values in the spreadsheet daiwuliz Excel 6 05-23-2018 10:30 AM
Highlight the current cell without using code parshla Excel 0 09-08-2016 08:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:18 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