Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-01-2020, 09:51 AM
gmaxey gmaxey is offline Remove highlight with specific color Windows 10 Remove highlight with specific color Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

It isn't a bug. You are explicitly ignoring the first instance found.


Code:
Sub ClearSpecificHighlight()
Dim oRngStory As Range
  For Each oRngStory In ActiveDocument.StoryRanges
    Do
      With oRngStory.Find
        .Highlight = True
        Do While .Execute
          If oRngStory.HighlightColorIndex = wdTurquoise Then
             oRngStory.HighlightColorIndex = wdNoHighlight
             oRngStory.Collapse 0
          End If
        Loop
      End With
      'Get next linked story (if any)
      Set oRngStory = oRngStory.NextStoryRange
    Loop Until oRngStory Is Nothing
  Next
lbl_exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove highlight with specific color Find/remove underline with specific color eduzs Word VBA 9 07-27-2020 07:43 AM
VBA to highlight specific values in the spreadsheet daiwuliz Excel 6 05-23-2018 10:30 AM
Remove highlight with specific color Remove white text background (keeping the font color and page color intact cc3125 Word 1 10-26-2015 06:44 PM
Change highlight color maceslin Word 3 04-30-2013 04:43 AM
Remove highlight with specific color change One highlight Color to Another Redbarn Word VBA 1 03-16-2013 02:03 PM

Other Forums: Access Forums

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