Forum Discussion

jdvelasquez's avatar
jdvelasquez
Copper Contributor
Mar 02, 2023
Solved

Ways to improve the performance of my Word macro that hides hard coded text

Hello,   I recycled an old macro in a https://www.techrepublic.com/article/macro-trick-how-to-highlight-multiple-search-strings-in-a-word-document/#:~:text=Click%20Reading%20Highlight%20and%20choos...
  • jdvelasquez Use the following code

     

    Dim arrWords As Variant
    arrWords = Split("EVALUACIÓN INTRODUCCIÓN|EVALUACIONES SOBRE EL DESEMPEÑO ACADÉMICO|administrada por", "|")
    For i = LBound(arrWords) To UBound(arrWords)
        Selection.HomeKey wdStory
        Selection.Find.ClearFormatting
        With Selection.Find
            .Text = arrWords(i)
            .Replacement.Font.Hidden = True
            .MatchWildcards = False
            .Wrap = wdFindContinue
            .MatchCase = False
        End With
        Selection.Find.Execute Replace:=wdReplaceAll
    Next i