Replace does not work well

Copper Contributor

Hi.

 

Since the last update of September 14, 2018, the function of replacing text does not work correctly.

My wish is to insert html tags before and after the bold text of a document, replacing it.

 

For example:

"La verdad es que hemos pasado de considerar al Presidente como capacitado totalmente para cualquier tipo de acción en nombre de la Comunidad"

 

The desired thing would be:

"La verdad es que hemos pasado de considerar al <strong>Presidente</strong> como capacitado totalmente para cualquier <strong>tipo de acción</strong> en nombre de la Comunidad"

 

However, it goes like this:

"La verdad es que hemos pasado de considerar al <strong>President<strong>e</strong<strong>></strong<strong>></strong<strong>></strong<strong>></strong<strong>></strong<strong>></strong<strong>></strong<strong>></</strong>strong> como capacitado totalmente para cualquier tipo de acción en nombre de la Comunidad"

 

I think it is a bug of the latest version (1808, compilation 10730.20102) because previously it worked correctly.

 

My vba code is the following:

    s.Find.ClearFormatting
    s.Find.Font.Bold = True
    s.Find.Replacement.ClearFormatting
    s.Find.Replacement.Font.Bold = False
    With s.Find
        .Text = ""
        .Replacement.Text = "<strong> ^ & </ strong>"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With


    s.Find.Execute Replace: = wdReplaceAll

 I wait for news. Thank you

1 Reply

Fortunately, it seems that it already works correctly. However, I notice that my version of Word is the same as it was when the errors occurred.

I will continue to observe if the same happens in the future.

Thank you.