Forum Discussion

null null's avatar
null null
Copper Contributor
Sep 17, 2018

Replace does not work well

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

  • SEPIN, SL --'s avatar
    SEPIN, SL --
    Copper Contributor

    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.

Resources