|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
论坛里例子很多,模仿写了一个。
Sub 提取信息()
Application.ScreenUpdating = False
Dim wordD As Word.Document
Dim wordapp As Object
Dim cPath$, cFile$, i%, arr()
cPath = ThisWorkbook.Path & "\"
cFile = Dir(cPath & "*.doc?")
Set wordapp = CreateObject("word.Application")
i = Range("A65535").End(xlUp).Row + 1
On Error Resume Next
Do While cFile <> ""
Set wordD = wordapp.Documents.Open(cPath & cFile)
With wordD.Tables(1)
Cells(i, 3) = Split(.Parent.Paragraphs(3).Range.Text, ":")(1)
Cells(i, 1) = Replace(.Cell(1, 2).Range.Text, Chr(7), "")
Cells(i, 2) = Replace(.Cell(1, 4).Range.Text, Chr(7), "")
Cells(i, 4) = Replace(.Cell(2, 2).Range.Text, Chr(7), "")
Cells(i, 5) = Replace(.Cell(2, 4).Range.Text, Chr(7), "")
i = i + 1
End With
wordD.Close
cFile = Dir
Loop
Set wordD = Nothing
wordapp.Quit
Application.ScreenUpdating = True
End Sub
|
评分
-
1
查看全部评分
-
|