|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
先引用Microsoft word 12.0(或14.0、11.0) object library 再运行下面代码
Sub cc()
Dim st$
st = Dir(ThisWorkbook.Path & "\*.doc?")
Do While st <> ""
Set app = New Word.Application
Set wdoc = app.Documents.Open(ThisWorkbook.Path & "\" & st, , True)
k = k + 1
m = Cells(Rows.Count, 2).End(3).Row + 1
Cells(m, 2) = Left(wdoc.Tables(1).Range.Cells(4).Range, Len(wdoc.Tables(1).Range.Cells(4).Range) - 1)
Cells(m, 3) = Left(wdoc.Tables(1).Range.Cells(8).Range, Len(wdoc.Tables(1).Range.Cells(8).Range) - 1)
Cells(m, 4) = Left(wdoc.Tables(1).Range.Cells(16).Range, Len(wdoc.Tables(1).Range.Cells(16).Range) - 1)
Cells(m, 6) = Left(wdoc.Tables(1).Range.Cells(20).Range, Len(wdoc.Tables(1).Range.Cells(20).Range) - 1)
wdoc.Close
st = Dir
Loop
app.qiut
Set wdoc = Nothing
Set app = Nothing
End Sub |
评分
-
1
查看全部评分
-
|