|
Option Explicit
Sub TEST() '
Dim ar(), i&, r&, strFileName$, strPath$, Rng As Range
Application.ScreenUpdating = False
strPath = ThisDocument.Path & "\"
strFileName = Dir(strPath & "*.doc*")
Do Until strFileName = ""
If strFileName <> ThisDocument.Name Then
With Documents.Open(strPath & strFileName)
Erase ar(): r = 0
With .Content.Find
Do While .Execute(FindText:="『正确答案』") = True
.Parent.Select
With Selection
.EndKey unit:=wdLine, Extend:=wdExtend
Set Rng = ActiveDocument.Range(.Start, .End - 1)
Rng.Select
r = r + 1
ReDim Preserve ar(1 To r)
Set ar(r) = .Range
End With
Loop
End With
If r Then
For i = 1 To r
ar(i).Text = "『正确答案』"
Next i
End If
.Close True
End With
End If
strFileName = Dir
Loop
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
1
查看全部评分
-
|