|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub excel汇总word文档信息()
Dim myapp, mydoc, mytab, i%, m%, n%, arr(1 To 1000, 1 To 7), mypath$, myname$
Set myapp = CreateObject("word.application")
mypath = ThisWorkbook.Path & "\内容.docx"
Set mydoc = myapp.documents.Open(mypath)
Set mytab = mydoc.tables
For i = 1 To mytab.Count
With mytab(i)
arr(i, 1) = .cell(2, 2).Range.Text: arr(i, 2) = .cell(3, , 2).Range.Text: arr(i, 3) = .cell(4, 2).Range.Text
arr(i, 4) = .cell(5, 2).Range.Text: arr(i, 5) = .cell(6, 2).Range.Text: arr(i, 6) = .cell(7, 2).Range.Text
arr(i, 7) = .cell(2, 4).Range.Text
End With
Next
mydoc.Close 0
myapp.Quit
[a2].Resize(1000, 7) = arr
End Sub
|
|