memphishoogl.blogg.se

How to remove background highlighting in word
How to remove background highlighting in word











#How to remove background highlighting in word code#

Apply the filtering code and deleting for the specific selection only, then check for a new page.Then go through each page and select the text. The code runs each page alone by making the code start from the first page and count the number of pages.

how to remove background highlighting in word

This happened with or without red highlighting color in the document. Once the MS Word got stuck, the cursor is changing rapidly, as if the screen has to be redrawn, and after a few seconds the program stops responding, and even if I wait for a while it will be stuck until I force to close the MS Word. 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. 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

how to remove background highlighting in word

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.

how to remove background highlighting in word

  • 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() 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.

    how to remove background highlighting in word

    I want to delete the red highlighting color from the MS Word document.











    How to remove background highlighting in word