Hi all,
Code:
Sub FormatLetterA()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Answer (A) "
.Replacement.Text = ""
.Replacement.Font.Bold = True
.Replacement.Font.Italic = False
.Replacement.Font.Color = 12611584
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Sub FormatLetterB()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Answer (B) "
.Replacement.Text = ""
.Replacement.Font.Bold = True
.Replacement.Font.Italic = False
.Replacement.Font.Color = 12611584
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Sub FormatLetterC()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Answer (C) "
.Replacement.Text = ""
.Replacement.Font.Bold = True
.Replacement.Font.Italic = False
.Replacement.Font.Color = 12611584
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Sub FormatLetterD()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Answer (D) "
.Replacement.Text = ""
.Replacement.Font.Bold = True
.Replacement.Font.Italic = False
.Replacement.Font.Color = 12611584
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
I have the above code in a macro and would like know if they could be combined in one.
I tried several options but I couldn't get them to work.
For example, the below code will only highlight the second option (.Text = "Answers (B), (C), and (D)") but not both.
Any help is appreciated. Thanks!!!
Code:
Sub FormatAllLetters()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Answers (A), (C), and (B)"
.Replacement.Text = ""
.Text = "Answers (B), (C), and (D)"
.Replacement.Text = ""
.Replacement.Font.Bold = True
.Replacement.Font.Color = 12611584
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub