|
- Sub Macro1()
- On Error Resume Next
- Dim mypath$, wj$, arr(1 To 20000, 1 To 6)
- Dim wd As New Word.Application
- mypath = ThisWorkbook.Path & ""
- wj = Dir(mypath & "*.doc")
- Do While wj <> ""
- s = s + 1
- arr(s, 1) = s
- With wd.Documents.Open(mypath & wj)
- arr(s, 2) = .Paragraphs(1).Range
- arr(s, 3) = .Paragraphs(2).Range & .Paragraphs(3).Range
- x = Split(Trim(.Paragraphs(4).Range), " ")
- arr(s, 4) = x(0)
- arr(s, 5) = x(1)
- rq = Trim(.Paragraphs(5).Range)
- arr(s, 6) = Mid$(rq, 2, Len(rq) - 3)
- .Close False
- End With
- wj = Dir
- Loop
- wd.Quit
- Range("a3").Resize(s, 6) = arr
- End Sub
复制代码 |
|