|
楼主,我没看附件,请——将光标定位于要处理的段落,试试下面的宏:(仅处理了第1个小题,可以按F8键逐一观察代码)
- Sub test()
- Dim r As Range, s As Range
- With Selection
- .Expand 4
- Set s = .Range
- .Find.ClearFormatting
- Do While .Find.Execute("/", , , 1, , , 1)
- If .Find.Found = True Then
- Do
- .MoveEnd unit:=wdCharacter, Count:=1
- If .Characters.First Like "[0-9.]" Then Exit Do
- If .Characters.First Like "[!0-9.]" Then .MoveStart unit:=wdCharacter, Count:=1
- Loop
- Do
- If .Characters.Last Like "[!0-9.]" Then
- .MoveEnd unit:=wdCharacter, Count:=-1
- Exit Do
- Else
- .MoveRight unit:=wdCharacter, Count:=1, Extend:=wdExtend
- End If
- Loop
- Set r = .Range
- .Copy
- .GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:="2" '光标定位于第2页页首
- .EndKey unit:=wdLine
- .Paste
- .TypeText Text:=" "
- r.SetRange Start:=r.End, End:=s.End
- r.Select
- End If
- Loop
- End With
- End Sub
复制代码
|
|