怎样利用VBA将一个文件夹下所有的word文档中的表格数据读取到一个excel中?
1个回答
展开全部
试一下以下代码, 祝你成功!
Dim fcc,fo,fso
Set fso = CreateObject("Scripting.filesystemobject")
Set fo = fso.getfolder("C:\AA") '文件夹
i=1
For Each fc In fo.subFolders
For Each fcc In fc.Files
If InStr(1, fcc.Name, ".doc", 1) Then
Range("A" & i) = fcc.Name
i = i + 1
End If
Next
Next
Dim fcc,fo,fso
Set fso = CreateObject("Scripting.filesystemobject")
Set fo = fso.getfolder("C:\AA") '文件夹
i=1
For Each fc In fo.subFolders
For Each fcc In fc.Files
If InStr(1, fcc.Name, ".doc", 1) Then
Range("A" & i) = fcc.Name
i = i + 1
End If
Next
Next
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询