- Sub a1001_AnswerRed()
- '根据答案标记选项行
- Dim r As Range, s As Range, t As Range, i As Paragraph, j&, k&
-
- With ActiveDocument
- With .Content.Font
- .NameFarEast = "宋体"
- .NameAscii = "Times New Roman"
- End With
-
- For Each i In .Paragraphs
- With i.Range
- If .Text Like "#*" Then
- With .Font
- .NameFarEast = "楷体"
- .NameAscii = "Times New Roman"
- .Bold = True
- End With
- .InsertParagraphBefore
- End If
- End With
- Next
-
- With .Content.Find
- .Execute "(答案):", , , 1, , , , , , "\1:", 2
- .Execute "([A-D])[.、]", , , 1, , , , , , "\1.", 2
- .Execute "(^13[0-9]{1,})[.、]", , , 1, , , , , , "\1.", 2
- End With
- Set r = .Content
- End With
-
- With r.Find
- .ClearFormatting
- .Text = "答案:"
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- .Next.Select
- With Selection
- .Extend vbCr
- .MoveEnd 1, -1
- Set s = .Range
- .MoveStart 4, -5
- .MoveEnd 4, -1
- Set t = .Range
- k = Len(s)
-
- For j = k To 1 Step -1
- For Each i In t.Paragraphs
- With i.Range
- If .Text Like s.Characters(j).Text & "*" Then
- With .Font
- .Bold = True
- .ColorIndex = wdRed
- .Underline = wdUnderlineSingle
- End With
- Exit For
- End If
- End With
- Next
- Next
- End With
- End With
- Loop
- End With
- Selection.HomeKey 6
- End Sub
复制代码 |