SHARE
TWEET

Untitled

a guest Apr 10th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub HighLightHeShe()
  2.  
  3.     Dim vFindText As Variant
  4.     Dim oRng As Range
  5.     Dim i As Long
  6.  
  7.     vFindText = Array("FS:HS")
  8.     For i = 0 To UBound(vFindText)
  9.         Set oRng = ActiveDocument.Range
  10.         With oRng.Find
  11.             .ClearFormatting
  12.             .Replacement.ClearFormatting
  13.             Do While .Execute(FindText:=vFindText(i), _
  14.                               MatchWholeWord:=True, _
  15.                               Forward:=True, _
  16.                               Wrap:=wdFindStop) = True
  17.                 oRng.HighlightColorIndex = wdTurquoise
  18.                 oRng.Collapse wdCollapseEnd
  19.             Loop
  20.         End With
  21.     Next
  22.    
  23.     vFindText = Array("FS:HRUK")
  24.     For i = 0 To UBound(vFindText)
  25.         Set oRng = ActiveDocument.Range
  26.         With oRng.Find
  27.             .ClearFormatting
  28.             .Replacement.ClearFormatting
  29.             Do While .Execute(FindText:=vFindText(i), _
  30.                               MatchWholeWord:=True, _
  31.                               Forward:=True, _
  32.                               Wrap:=wdFindStop) = True
  33.                 oRng.Shading.Texture = wdTextureNone
  34.                 oRng.Shading.ForegroundPatternColor = wdColorAutomatic
  35.                 oRng.Shading.BackgroundPatternColor = 39423
  36.                 oRng.Collapse wdCollapseEnd
  37.             Loop
  38.         End With
  39.     Next
  40.    
  41.     vFindText = Array("FS:HEU")
  42.     For i = 0 To UBound(vFindText)
  43.         Set oRng = ActiveDocument.Range
  44.         With oRng.Find
  45.             .ClearFormatting
  46.             .Replacement.ClearFormatting
  47.             Do While .Execute(FindText:=vFindText(i), _
  48.                               MatchWholeWord:=True, _
  49.                               Forward:=True, _
  50.                               Wrap:=wdFindStop) = True
  51.                 oRng.Shading.Texture = wdTextureNone
  52.                 oRng.Shading.ForegroundPatternColor = wdColorAutomatic
  53.                 oRng.Shading.BackgroundPatternColor = 65280
  54.                 oRng.Collapse wdCollapseEnd
  55.             Loop
  56.         End With
  57.     Next
  58.    
  59.         vFindText = Array("FS:O")
  60.     For i = 0 To UBound(vFindText)
  61.         Set oRng = ActiveDocument.Range
  62.         With oRng.Find
  63.             .ClearFormatting
  64.             .Replacement.ClearFormatting
  65.             Do While .Execute(FindText:=vFindText(i), _
  66.                               MatchWholeWord:=True, _
  67.                               Forward:=True, _
  68.                               Wrap:=wdFindStop) = True
  69.                 oRng.HighlightColorIndex = wdRed
  70.                 oRng.Collapse wdCollapseEnd
  71.             Loop
  72.         End With
  73.     Next
  74.    
  75.  
  76.     vFindText = Array("CS:A", "CS:B", "CS:C", "CS:D", "CS:E", "CS:F", "CS:G", "CS:H", "CS:I", "CS:J", "CS:K", "CS:L")
  77.     For i = 0 To UBound(vFindText)
  78.         Set oRng = ActiveDocument.Range
  79.         With oRng.Find
  80.             .ClearFormatting
  81.             .Replacement.ClearFormatting
  82.             Do While .Execute(FindText:=vFindText(i), _
  83.                               MatchWholeWord:=True, _
  84.                               Forward:=True, _
  85.                               Wrap:=wdFindStop) = True
  86.                 oRng.Shading.Texture = wdTextureNone
  87.                 oRng.Shading.ForegroundPatternColor = wdColorAutomatic
  88.                 oRng.Shading.BackgroundPatternColor = 13408767
  89.                 oRng.Collapse wdCollapseEnd
  90.             Loop
  91.         End With
  92.     Next
  93.    
  94.         vFindText = Array("CS:M", "CS:N", "CS:O", "CS:P", "CS:Q", "CS:R", "CS:S", "CS:T", "CS:U", "CS:V", "CS:W", "CS:X", "CS:Y", "CS:Z")
  95.     For i = 0 To UBound(vFindText)
  96.         Set oRng = ActiveDocument.Range
  97.         With oRng.Find
  98.             .ClearFormatting
  99.             .Replacement.ClearFormatting
  100.             Do While .Execute(FindText:=vFindText(i), _
  101.                               MatchWholeWord:=True, _
  102.                               Forward:=True, _
  103.                               Wrap:=wdFindStop) = True
  104.                 oRng.HighlightColorIndex = wdYellow
  105.                 oRng.Collapse wdCollapseEnd
  106.             Loop
  107.         End With
  108.     Next
  109.    
  110.     With ActiveDocument.PageSetup
  111.         .LineNumbering.Active = False
  112.         .Orientation = wdOrientPortrait
  113.         .TopMargin = CentimetersToPoints(1.6)
  114.         .BottomMargin = CentimetersToPoints(0.52)
  115.         .LeftMargin = CentimetersToPoints(1.1)
  116.         .RightMargin = CentimetersToPoints(1.52)
  117.         .HeaderDistance = CentimetersToPoints(1.27)
  118.         .FooterDistance = CentimetersToPoints(1.27)
  119.         .PageWidth = CentimetersToPoints(21.01)
  120.         .PageHeight = CentimetersToPoints(29.7)
  121.     End With
  122.    
  123. lbl_Exit:
  124.     Exit Sub
  125. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top