|
Sub ss()
Dim i, j, arr, txt, MyDoc As Object, reg As Object, mh
Set MyDoc = GetObject(ThisWorkbook.Path & "\原稿.docx")
txt = MyDoc.Content.Text
MyDoc.Close
Set MyDoc = Nothing
Set reg = CreateObject("vbscript.regexp")
reg.Global = True
reg.Pattern = "([0-9]+.[\w\W]+?)(A.[\w\W]+?)(B.[\w\W]+?)(C.[\w\W]+?)(D.[\w\W]+?)【分析】([\w\W]+?)故选[:]?([A-Z]+)"
If reg.test(txt) Then
Set mh = reg.Execute(txt)
ReDim arr(1 To mh.Count, 1 To 7)
For i = 1 To UBound(arr)
For j = 1 To UBound(arr, 2)
arr(i, j) = mh(i - 1).submatches(j - 1)
Next j
Next i
End If
Set reg = Nothing
Sheet1.Range("B2").Resize(UBound(arr), UBound(arr, 2)) = arr
End Sub
|
评分
-
1
查看全部评分
-
|