Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Jim , 18th November 05:23
- Hi!
- Sarah , 19th November 06:03
- Hello there
- Public Sub ColorMeRedBlue()
- Selection.HomeKey Unit:=wdStory
- color_the_text = False
- For Each line_in_para In ActiveDocument.Paragraphs
- text_in_line = line_in_para.Range.Text
- check_name = Split(text_in_line, " ")
- If InStr("Jim", check_name(0)) Then
- color_the_text = False
- ElseIf InStr("Sarah", check_name(0)) Then
- color_the_text = True
- End If
- If color_the_text = False Then
- Selection.HomeKey Unit:=wdLine
- Selection.EndKey Unit:=wdLine, Extend:=wdExtend
- Selection.Font.Color = wdColorRed
- Selection.EndKey Unit:=wdLine, Extend:=wdExtend
- Selection.EndKey Unit:=wdLine
- Selection.MoveDown Unit:=wdLine, Count:=1
- ElseIf color_the_text = True Then
- Selection.HomeKey Unit:=wdLine
- Selection.EndKey Unit:=wdLine, Extend:=wdExtend
- Selection.Font.Color = wdColorBlue
- Selection.EndKey Unit:=wdLine, Extend:=wdExtend
- Selection.EndKey Unit:=wdLine
- Selection.MoveDown Unit:=wdLine, Count:=1
- End If
- Next line_in_para
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement