Wildcard Find and Replace with Track Changes

While Track Changes is active, a wild card Find and Replace action does not yield the results expected. For instance, in a document, the occurrence of XYZ 123 (i.e. any three alpha characters followed by a space followed by any three numerals) needs to be changed to XYZ-123 (i.e. the three alpha characters followed by a hyphen followed by the three numerals). Normally (without Track Changes), the code for this operation would be (in the Find what: line) ([A-Z]{3}) ([0-9]{3}) and (in the Replace with: line) \1-\2. Yet, with Track Changes active, the results from this action is the following: XYZ123-, i.e. the hyphen is placed not between the two 'Find what' elements, but after the second element. Should I be doing something different, or is this a bug? Even older versions of Word give the same result.
This is an old bug; you can read a thread about it from 2006 here. It has never been fixed.

As stated in this page, the only workaround is to turn off Track Changes while making the replacement.

If it's important to have the replacements marked as changes, you could turn on Track Changes and run another replacement, finding ([A-Z]{3})-([0-9]{3}) and replacing with ^& (which is the code for "Find What Text"). That would at least get the change bars in the margins at the right places.

If this is a frequent requirement, it would be best to write it into a macro.
_____________________________
https://jay-freedman.info

3 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

You are not doing anything wrong.  It's never been high enough  on the  bug list to fix, I guess.   I just turn  track changes off when I have to run such F&Rs.

Pam
Pamelia Caswell

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thanks Jay and Pam for the workarounds offered.

In our organisation, the document compilers all send their documents to me for editing. Using track changes, I edit the documents, and return it to them to either accept or reject my edits (normally not too much of the latter). It therefore serves a secondary function to educate the compilers about our particular document standards.

But, if it ain't working, it ain't working. I guess the Word users just haven't shouted loud enough.

Thanks a million guys!

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

If I need to call the change to the author's attention, I highlight then first one and write a comment. It's better making the changes by hand!

Pam
Pamelia Caswell

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I realize this thread is pretty old, but I thought I'd post a partial workaround in case someone runs into this same issue, although for the example given above, the workaround won't work.

I was trying to replace

1Q 2010

with

1Q10

and getting the same kind of result with track changes on: 110Q (right elements, wrong order).

My original string looked like this:

Find what: ([1-4])Q [0-9][0-9]([0-9][0-9])

Replace with: \1Q\2

By making the Q a wildcard, I was able to get it to work.

Find what: ([1-4])([Q]) [0-9][0-9]([0-9][0-9])Replace with: \1\2\3

This won't work with the original poster's example because he is actually changing the found text from a space to a hyphen. Maybe someone can think of a way to extend the workaround to work for such instance, but this is at least something.

Hope this helps someone.

-Vince

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I just encountered this problem myself in Word 2013. Here is a workaround that seems to work with track changes switched on:

Sub Workaround()

'Adds a hyphen between the 1 and 2 in "12"

With ActiveDocument.Content
With .Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Text = "(<[1])([2]>)"
  .Replacement.Text = ""
  .Forward = True
  .Wrap = wdFindStop
  .MatchWildcards = True
  .Execute
End With
Do While .Find.Found
  .MoveStart wdCharacter, 1
  .Collapse
  .InsertAfter "-"
  .MoveStart wdWord, -1
  .MoveEnd wdWord, 1
  .Copy
  .Delete
  .Collapse wdCollapseEnd
  .Paste
  .Find.Execute
Loop
End With

End Sub

4 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated December 27, 2023 Views 3,848 Applies to: