SOLVED

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

%3CLINGO-SUB%20id%3D%22lingo-sub-253711%22%20slang%3D%22en-US%22%3EFind%20and%20Replace%20in%20Word%20has%20bugs%20after%20latest%20update%20to%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-253711%22%20slang%3D%22en-US%22%3E%3CP%3EAfter%20the%20latest%20update%20to%20Windows%2C%20Find-and-Replace%20stopped%20working%20correctly%20for%20many%20cases.%20In%20particular%2C%20if%20you%20try%20to%20specify%20font%20attributes%20in%20a%20replace%2C%20they%20are%20usually%20ignored.%20Also%2C%20the%20Replace%20button%20does%20not%20advance%20to%20the%20next%20item.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20a%20VBA%20application%20that%20helps%20me%20produce%20books%20and%20many%20of%20its%20operations%20just%20stopped%20working%20correctly.%20When%20I%20tried%20to%20do%20them%20manually%20from%20the%20Word%20document%20window%2C%20they%20failed%20there%20as%20well.%3CBR%20%2F%3E%3CBR%20%2F%3EOne%20example%20is%20a%20FInd-and-Replace%20with%20the%20search%20text%20%22(%2F)(*)(%2F)%22%20with%20a%20font%20of%20%22MS%20Trebuchet%22%20specified%20to%20find%20all%20cases%20of%20%22%2Fname%2F%22%20in%20that%20font.%20Wildcards%20are%20enabled.%3CBR%20%2F%3EThe%20replacement%20text%20is%20%22%5C2%22%20which%20should%20remove%20the%20slashes%20around%20the%20name.%20I%20specify%20highlighting%20the%20text%20on%20the%20replacement.%20The%20slashes%20disappear%2C%20but%20no%20highlighting%20occurs.%3CBR%20%2F%3EDoing%20it%20manually%20from%20the%20Word%20window%20has%20the%20same%20problem%20so%20it's%20not%20just%20a%20VBA%20issue.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ESo%2C%20I%20tried%20it%20specifying%20that%20the%20replacement%20text%20should%20be%20%22red%22.%20No%20luck%20there%20either.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EI%20finally%20rewrote%20the%20code%20to%20only%20use%20the%20find%20part%20and%20then%20use%20a%20While%20.Execute%20loop%20to%20do%20the%20replacement.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EOK%2C%20so%20that%20workaround%20did%20the%20trick.%20Unfortunately%2C%20I%20have%20many%20other%20cases%20that%20do%20a%20find-and-replace%20where%20attributes%20are%20part%20of%20the%20operation.%20I'm%20not%20looking%20forward%20to%20having%20to%20rewrite%20a%20lot%20of%20code%20to%20get%20around%20what%20is%20apparently%20a%20new%20bug.%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20I%20can't%20find%20a%20fast%20solution%2C%20I%20will%20try%20to%20revert%20the%20last%20Windows%20update.%20As%20that%20doesn't%20always%20work%20well%2C%20I'm%20trying%20to%20avoid%20it.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20for%20any%20suggestions.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-253711%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-255119%22%20slang%3D%22en-US%22%3ERe%3A%20Find%20and%20Replace%20in%20Word%20has%20bugs%20after%20latest%20update%20to%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-255119%22%20slang%3D%22en-US%22%3E%3CP%3ESame%20here!%26nbsp%3B%20I%20even%20left%20Word%20VBA%20running%20and%20stopped%20in%20the%20middle%20of%20a%20procedure%20when%20I%20left%20work%20yesterday%20(on%20purpose%20because%20I%20was%20coding%20a%20workaround)%2C%20and%20it%20was%20still%20up%20when%20I%20arrived%20this%20morning%2C%20so%20it%20doesn't%20look%20like%20anything%20even%20had%20to%20be%20restarted.%26nbsp%3B%20Like%20you%2C%20I'll%20take%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-255009%22%20slang%3D%22en-US%22%3ERe%3A%20Find%20and%20Replace%20in%20Word%20has%20bugs%20after%20latest%20update%20to%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-255009%22%20slang%3D%22en-US%22%3E%3CP%3EMagic%20happened.%20I'm%20not%20sure%20what%20it%20was%2C%20but%20everything%20started%20working%20again%20about%203am%20this%20morning.%20I%20couldn't%20sleep%20and%20doing%20some%20work%20that%20included%20running%20my%20app.%20Imagine%20my%20surprise%20when%20everything%20worked.%3CBR%20%2F%3E%3CBR%20%2F%3EI've%20looked%20and%20can't%20see%20anything%20that%20updated.%3CBR%20%2F%3E%3CBR%20%2F%3EOh%20well%2C%20another%20mystery.%20But%2C%20I'll%20take%20it.%20I%20was%20getting%20desperate.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-253966%22%20slang%3D%22en-US%22%3ERe%3A%20Find%20and%20Replace%20in%20Word%20has%20bugs%20after%20latest%20update%20to%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-253966%22%20slang%3D%22en-US%22%3E%3CP%3EA%20really%20simple%20test%20anyone%20can%20do.%3C%2FP%3E%3CP%3E1.%20Open%20almost%20any%20document%20in%20Word.%20Do%20a%20find-and-replace%20(Ctrl-h)%20from%20the%20keyboard.%26nbsp%3B%3C%2FP%3E%3CP%3E2.%20Specify%20the%20text%20to%20find%20as%20%22the%22.%3C%2FP%3E%3CP%3E3.%20Specify%20the%20replacement%20text%20as%20%22%5E%26amp%3B%22%20(which%20means%20with%20the%20same%20text%20we%20just%20found).%3C%2FP%3E%3CP%3E4.%20Specify%20that%20the%20replacement%20text%20should%20be%20%22red%22.%3C%2FP%3E%3CP%3E5.%20Click%20on%20%22Replace%20all%22.%3C%2FP%3E%3CP%3EIt%20should%20then%20run%20for%20a%20long%20time%20and%20tell%20you%20that%20it%20did%20a%20huge%20number%20of%20replacements%20(in%20one%20test%2034281%2C%20but%20a%20simple%20Find%20of%20%22the%22%20showed%20284%20instances)%2C%20but%20nothing%20is%20actually%20changed.%3C%2FP%3E%3CP%3E6.%20Click%20on%20%22Find%20next%22%20then%20on%20%22Replace%22.%26nbsp%3B%3C%2FP%3E%3CP%3ENothing%20is%20changed%20and%20it%20does%20not%20advance%20to%20the%20next%20find%20after%20clicking%20on%20%22Replace%22.%20Click%20on%20%22Find%20next%22%20and%20it%20does%20advance%20but%20nothing%20was%20changed%20for%20the%20previous%20instance.%20You%20can%20do%20this%20as%20much%20as%20you%20want%20and%20the%20same%20things%20happens%20over%20again%20each%20time.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-253923%22%20slang%3D%22en-US%22%3ERe%3A%20Find%20and%20Replace%20in%20Word%20has%20bugs%20after%20latest%20update%20to%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-253923%22%20slang%3D%22en-US%22%3E%3CP%3EYes!%26nbsp%3B%20I've%20noticed%20the%20following%20new%20behavior%20in%20the%20past%20few%20days%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EReplacing%20any%20text%20with%20the%20same%20text%20formatted%20differently%20results%20in%20just%20the%20original%20text%20and%20original%20formatting.%26nbsp%3B%20This%20is%20true%20whether%20using%20wildcards%20or%20not.%26nbsp%3B%20In%20a%20sample%20document%20that%20contains%20the%20text%20%22One%20two%20%3CSTRONG%3Ethree%3C%2FSTRONG%3E%20four%20three%20seven%20eight%20nine%2C%22%20where%20the%20first%20instance%20of%20%22three%22%20is%20bold%20and%20the%20second%20one%20is%20not%2C%20replacing%20all%20bold%20instances%20of%20%22three%22%20with%20unbolded%20%22three%22%20results%20in%20no%20visible%20change%20but%20a%20report%20of%207%20replacements%20made.%3C%2FLI%3E%3CLI%3EUsing%20wildcards%2C%20replacing%20all%20instances%20of%20%22(%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20)(%5B0-9%5D)%22%20with%20%22%5C1%26nbsp%3B%26nbsp%3B%20%5C2%22%20inserts%20the%20three%20spaces%2C%20but%20then%20the%20selection%20doesn't%20advance%2C%20so%20instead%20of%20adding%20three%20spaces%20to%20each%20instance%2C%20it%20adds%20lots%20of%20spaces%20to%20just%20the%20first%20instance.%3C%2FLI%3E%3CLI%3EThere's%20now%20apparently%20a%20limit%20to%20the%20number%20of%20replacements%20that%20will%20be%20done%20during%20one%20Replace%20All.%26nbsp%3B%20This%20is%20true%20whether%20triggered%20manually%20or%20by%20VBA.%26nbsp%3B%20In%20the%20previous%20bullet%20point%2C%20the%20inserted%20spaces%20took%20up%20about%20two%20lines%20before%20stopping.%26nbsp%3B%20In%20a%20188-page%20document%20with%20lots%20of%20double%20line%20breaks%2C%20using%20wildcards%20to%20replace%20%22(%5E13)(%5E13)%22%20with%20%22%5C1%22%20results%20in%20126%20pages%20of%20correct%20replacements%20and%2062%20pages%20of%20no%20replacements.%26nbsp%3B%20Previously%20this%20size%20document%20worked%20just%20fine.%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOur%20office%20uses%20Find-and-Replace%20in%20LOTS%20of%20VBA%20procedures%20every%20single%20day%2C%20and%20many%20of%20those%20procedures%20are%20used%20by%20people%20who%20need%20to%20click%20a%20button%20and%20have%20it%20run%20flawlessly%2C%20so%20this%20is%20a%20problem%20for%20us.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New 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
Highlighted

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.

Highlighted

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.

Highlighted
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.

Highlighted

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.