|
本帖最后由 zhanglei1371 于 2020-5-17 15:59 编辑
- Sub 题库答案解析还原()
- Dim pa As Paragraph, arr(), brr(), crr()
- Dim rg As Range, rg1 As Range
- Selection.HomeKey 6
- Selection.Find.Execute "([!^13])答案", , , 1, , , , , , "\1", 2
- ActiveDocument.Range.InsertAfter chr(13) & "123456."
- i = 0
- Selection.HomeKey 6
- With Selection.Find
- .Text = "答案"
- .Replacement.Text = "^&"
- If .Execute Then
- mst = Selection.Start
- Selection.InsertBefore "12345."
- mend = Selection.End
- End If
- End With
- Selection.HomeKey 6
- With Selection.Find
- .Text = "[0-9]@."
- .MatchWildcards = 1
- Do While .Execute
- ReDim Preserve arr(i)
- If .Parent <> "1." Then
- arr(i) = .Parent.Start
- i = i + 1
- End If
- If InStr(Selection.Paragraphs(1).Range, "答案") Then Exit Do
- Loop
- End With
- Selection.EndKey
- With Selection.Find
- j = 0
- .Text = "[0-9]@."
- .MatchWildcards = 1
- Do While .Execute
- ReDim Preserve brr(j)
- If Selection.Previous = Chr(13) Then
- brr(j) = .Parent.Start
- j = j + 1
- End If
- Loop
- End With
- For jj = 1 To j - 1
- ReDim Preserve crr(jj - 1)
- crr(jj - 1) = ActiveDocument.Range(brr(jj - 1), brr(jj))
- Next
- For ij = i To 1 Step -1
- DoEvents
- ActiveDocument.Range(arr(ij - 1), arr(ij - 1)).Select
- Selection.InsertAfter crr(ij - 1)
- Next
- Selection.EndKey
- Selection.Find.Execute "12345.*123456.", , , 1, , , , , , "", 1
- MsgBox "ok"
- End Sub
复制代码
仅对附件文档有效。
|
评分
-
1
查看全部评分
-
|