document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. Sub highlight_test_results()
  2. \'
  3. \' highlight_test_results Macro by @francisluong
  4. \' Find instances of "Test Result:" which are not highlighted and:
  5. \'  - extend selection to end of line`
  6. \'  - highlight it
  7. \'
  8.  
  9.     Dim iCount As Integer
  10.     Dim searchDone As Boolean
  11.     Dim searchTextArray(0 To 0) As String
  12.     Dim searchText As Variant
  13.     searchTextArray(0) = "Test Result:"
  14.     Options.DefaultHighlightColorIndex = wdYellow
  15.    
  16.     For Each searchText In searchTextArray
  17.    
  18.         Selection.HomeKey Unit:=wdStory
  19.                
  20.         searchDone = False
  21.         iCount = 0
  22.        
  23.         Do While searchDone = False And iCount < 1000
  24.            
  25.             iCount = iCount + 1
  26.              
  27.             Selection.HomeKey Unit:=wdStory
  28.             With Selection.Find
  29.                 .ClearFormatting
  30.                 .Forward = True
  31.                 .Wrap = wdFindContinue
  32.                 .Text = searchText
  33.                 .Highlight = False
  34.             End With
  35.             Selection.Find.Execute
  36.            
  37.             If Selection.Find.Found Then
  38.                 Selection.EndOf Unit:=wdLine, Extend:=wdExtend
  39.                 Selection.Range.HighlightColorIndex = wdYellow
  40.             Else: searchDone = True
  41.             End If
  42.         Loop
  43.     Next searchText
  44.        
  45. End Sub
');