SOLVED

Find and Replace in Word has bugs after latest update to Windows

Copper Contributor

After the latest update to Windows, Find-and-Replace stopped working correctly for many cases. In particular, if you try to specify font attributes in a replace, they are usually ignored. Also, the Replace button does not advance to the next item.

I have a VBA application that helps me produce books and many of its operations just stopped working correctly. When I tried to do them manually from the Word document window, they failed there as well.

One example is a FInd-and-Replace with the search text "(/)(*)(/)" with a font of "MS Trebuchet" specified to find all cases of "/name/" in that font. Wildcards are enabled.
The replacement text is "\2" which should remove the slashes around the name. I specify highlighting the text on the replacement. The slashes disappear, but no highlighting occurs.
Doing it manually from the Word window has the same problem so it's not just a VBA issue.


So, I tried it specifying that the replacement text should be "red". No luck there either. 

I finally rewrote the code to only use the find part and then use a While .Execute loop to do the replacement. 

OK, so that workaround did the trick. Unfortunately, I have many other cases that do a find-and-replace where attributes are part of the operation. I'm not looking forward to having to rewrite a lot of code to get around what is apparently a new bug.

If I can't find a fast solution, I will try to revert the last Windows update. As that doesn't always work well, I'm trying to avoid it.

Thanks for any suggestions.

4 Replies

Yes!  I've noticed the following new behavior in the past few days:

 

  • Replacing any text with the same text formatted differently results in just the original text and original formatting.  This is true whether using wildcards or not.  In a sample document that contains the text "One two three four three seven eight nine," where the first instance of "three" is bold and the second one is not, replacing all bold instances of "three" with unbolded "three" results in no visible change but a report of 7 replacements made.
  • Using wildcards, replacing all instances of "(     )([0-9])" with "\1   \2" inserts the three spaces, but then the selection doesn't advance, so instead of adding three spaces to each instance, it adds lots of spaces to just the first instance.
  • There's now apparently a limit to the number of replacements that will be done during one Replace All.  This is true whether triggered manually or by VBA.  In the previous bullet point, the inserted spaces took up about two lines before stopping.  In a 188-page document with lots of double line breaks, using wildcards to replace "(^13)(^13)" with "\1" results in 126 pages of correct replacements and 62 pages of no replacements.  Previously this size document worked just fine.

 

Our office uses Find-and-Replace in LOTS of VBA procedures every single day, and many of those procedures are used by people who need to click a button and have it run flawlessly, so this is a problem for us.

A really simple test anyone can do.

1. Open almost any document in Word. Do a find-and-replace (Ctrl-h) from the keyboard. 

2. Specify the text to find as "the".

3. Specify the replacement text as "^&" (which means with the same text we just found).

4. Specify that the replacement text should be "red".

5. Click on "Replace all".

It should then run for a long time and tell you that it did a huge number of replacements (in one test 34281, but a simple Find of "the" showed 284 instances), but nothing is actually changed.

6. Click on "Find next" then on "Replace". 

Nothing is changed and it does not advance to the next find after clicking on "Replace". Click on "Find next" and it does advance but nothing was changed for the previous instance. You can do this as much as you want and the same things happens over again each time.

best response confirmed by Ronald Smith (Copper Contributor)
Solution

Magic happened. I'm not sure what it was, but everything started working again about 3am this morning. I couldn't sleep and doing some work that included running my app. Imagine my surprise when everything worked.

I've looked and can't see anything that updated.

Oh well, another mystery. But, I'll take it. I was getting desperate.

Same here!  I even left Word VBA running and stopped in the middle of a procedure when I left work yesterday (on purpose because I was coding a workaround), and it was still up when I arrived this morning, so it doesn't look like anything even had to be restarted.  Like you, I'll take it.

1 best response

Accepted Solutions
best response confirmed by Ronald Smith (Copper Contributor)
Solution

Magic happened. I'm not sure what it was, but everything started working again about 3am this morning. I couldn't sleep and doing some work that included running my app. Imagine my surprise when everything worked.

I've looked and can't see anything that updated.

Oh well, another mystery. But, I'll take it. I was getting desperate.

View solution in original post