cowboypoy.blogg.se

How to remove highlighting in word document
How to remove highlighting in word document















docx file type), once I run the code, it goes through the document pages and finds and deletes the red highlighting color, that once all are replaced, the MS Word stuck. What I noticed is, in some documents only (mixed of. Consequently, neither condition will be processed.

HOW TO REMOVE HIGHLIGHTING IN WORD DOCUMENT CODE

Additionally, I haven't included code to test whether a found range spans some text as well as part of a field or spans two or more highlight colours. End = Then Exit Doĭo note that there's a bug in Word's Find which means it won't find anything if the document consists of a single highlighted paragraph. 'The next line is needed if the highlighted content could include the final paragraph break Information(wdAtEndOfRowMarker) = True Then End If block is needed if the highlighted content could be in a table Find with a range the range is redefined each time a match is found, enabling you to change the properties of that range. In this instance you can avoid using Selection by using a Range object instead ( ActiveDocument.Content is a range). As Selection.Find selects every match it finds that is a lot of redrawing. When you select things in your code the screen has to be redrawn with each change of selection. The big problem with your code is that you are using the Selection object. The one shown in the code check for all highlighting colors and if the color is red, then remove it, otherwise check for another.

  • The main issue is the While loop or any loop that I am using.
  • There is no difference if I keep or remove Format, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, and MatchAllWordForms.
  • The record marco detect all highlighting color not specific color.
  • Some of the code I got from the record marco feature and from help online.
  • This is why I mentioned the first statement.
  • I noticed if I select at the middle of the document then run the code, the code start from the mouse selection not from the top.
  • Wrap = wdFindStop 'stop at the end of the documentĭo While (.Execute(Forward:=True) = True) = True Selection.GoTo wdGoToPage, wdGoToAbsolute, 1 'Start at the top of the document ' This Macro go through the document and search for any Red color highlighting word and remove it ' Remove Specific Highlighting Color Macro The VBA code that I wrote: Sub RemoveSpecificHighlightingColor()

    how to remove highlighting in word document

    Execute Replace:=wdReplaceAll instead of the loop. Replacement.HighlightColorIndex = wdred and then. I'm not sure why it gets crashing, but I guess due to the loop that I am using. The following code is either working fine or make the MS Word stop responding. I made a module in MS Word documents that search/find any text highlighting with red color - a text marked with red from the tool shown in the image below. I want to delete the red highlighting color from the MS Word document.















    How to remove highlighting in word document