|
本帖最后由 tcdatongye 于 2021-6-5 22:35 编辑
Sub 美化()
Dim drr(1), rng As Range
drr(0) = "\[[0-9]@": drr(1) = "[\(\)]"
For j = 0 To 1
If j = 1 Then 逻辑 = 1
With ThisDocument.Content.Find
.MatchWildcards = True
Do While .Execute(findtext:=drr(j))
Set rng = .Parent.Next(unit:=wdParagraph)
kk = Space(2)
For i = 0 To 4
rr = Left(rng, Len(rng) - 1)
cc = RTrim(Replace(rr, ".", ""))
If (Left(cc, 1) Like "[A-E]") Then
jj = Chr(65 + i) & "." & Mid(cc, 2, Len(cc) - 1)
Else
jj = Chr(65 + i) & "." & cc
End If
kk = kk & Space(2) & jj
If i < 4 Then Set rng = rng.Next(unit:=wdParagraph)
Next i
rng.MoveStart unit:=wdParagraph, Count:=-4
rng.Text = kk & vbCr
rng.ListFormat.RemoveNumbers
rng.Select
Selection.ClearFormatting
If 逻辑 = 1 Then
If Left(rng.Next(unit:=wdParagraph).Text, 4) = "二、配伍" Then
rng.Move
rng.Find.Execute findtext:="综合分析选择题"
逻辑 = 0: drr(1) = "\([ \)]@"
End If
End If
.Parent.Start = rng.End
Loop
End With
Next j
End Sub
|
|