|
我才自学的,代码很简陋,不会高级的用法
我把答案分离出来了,放另外一个文档,都在压缩包内
你打开妇产科.docm 我代码写里面了,答案跟这个文件放同一个文件夹就行
Sub 插入答案()
Dim i%
Application.ScreenUpdating = False
On Error Resume Next
Application.Documents.Open ThisDocument.Path & "\答案.docx"
答案集合 = Split(ActiveDocument.Content, Chr(13))
ThisDocument.Activate
Selection.HomeKey wdStory
Selection.MoveDown wdParagraph, 1
For i = 0 To UBound(答案集合) - 1
答 = 答案集合(i)
With Selection.Find
.ClearFormatting
.Text = "[0-9]{1,3}.【单选题】"
.MatchWildcards = True
.Forward = True
If .Execute Then
Selection.Collapse 1
Selection.MoveLeft wdCharacter, 1
Selection.TypeParagraph
Selection.TypeText i + 1 & "答案:" & Split(答, ".")(1)
Selection.MoveDown wdParagraph, 3
End If
End With
Next
Application.ScreenUpdating = True
On Error GoTo 0
End Sub
妇产科加答案.zip
(69.34 KB, 下载次数: 26)
|
|