ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: lsc900707

[求助] 如何提取word文档中多个简历信息至excel汇总表

[复制链接]

TA的精华主题

TA的得分主题

发表于 2016-7-27 13:48 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
居然每个word表的行数都不一致!

h.rar

30.01 KB, 下载次数: 179

评分

1

查看全部评分

TA的精华主题

TA的得分主题

发表于 2016-7-27 13:49 | 显示全部楼层
lsc900707 发表于 2016-7-27 13:47
谢谢!看来我刚学习这个课题就挑了个“刺”!

小公司用不到这个,一年也招不了几个人,不动脑手工最好。

TA的精华主题

TA的得分主题

 楼主| 发表于 2016-7-27 13:51 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
Sub word文档转excel汇总()
     On Error Resume Next
     [A2:AI250].ClearContents
     Application.ScreenUpdating = False
     Dim cPath$, cFile$, str$, i%, arr(1 To 500, 1 To 35)
     Dim wordD As Word.Document
     Dim Wordapp As Object
     Set Wordapp = CreateObject("Word.Application")
     cPath = ThisWorkbook.Path & "\"
     cFile = Dir(cPath & "*.doc?")
     Do While cFile <> ""
         Set wordD = Wordapp.Documents.Open(cPath & cFile)
         For i = 1 To wordD.Tables.Count
             With wordD.Tables(i)
                 arr(i, 1) = i
                 arr(i, 2) = Replace(.Cell(2, 2).Range.Text, Chr(7), "")
                 arr(i, 3) = Replace(.Cell(2, 4).Range.Text, Chr(7), "")
                 arr(i, 4) = Replace(.Cell(2, 6).Range.Text, Chr(7), "")
                 arr(i, 5) = Replace(.Cell(3, 2).Range.Text, Chr(7), "")
                 arr(i, 6) = Replace(.Cell(3, 4).Range.Text, Chr(7), "")
                 arr(i, 7) = Replace(.Cell(3, 6).Range.Text, Chr(7), "")
                 arr(i, 8) = Replace(.Cell(4, 2).Range.Text, Chr(7), "")
                 arr(i, 9) = Replace(.Cell(4, 4).Range.Text, Chr(7), "")
                 arr(i, 10) = Replace(.Cell(5, 2).Range.Text, Chr(7), "")
                 arr(i, 11) = Replace(.Cell(5, 4).Range.Text, Chr(7), "")
                 arr(i, 12) = Replace(.Cell(6, 3).Range.Text, Chr(7), "")
                 arr(i, 13) = Replace(.Cell(6, 5).Range.Text, Chr(7), "")
                 arr(i, 14) = Replace(.Cell(7, 3).Range.Text, Chr(7), "")
                 arr(i, 15) = Replace(.Cell(7, 5).Range.Text, Chr(7), "")
                 arr(i, 16) = Replace(.Cell(8, 2).Range.Text, Chr(7), "")
                 arr(i, 17) = Replace(.Cell(8, 4).Range.Text, Chr(7), "")
                 arr(i, 18) = Replace(.Cell(9, 2).Range.Text, Chr(7), "")
                 arr(i, 19) = Replace(.Cell(9, 4).Range.Text, Chr(7), "")
                 arr(i, 20) = Replace(.Cell(9, 6).Range.Text, Chr(7), "")
                 arr(i, 21) = Replace(.Cell(10, 2).Range.Text, Chr(7), "")
                 arr(i, 22) = Replace(.Cell(13, 2).Range.Text, Chr(7), "")
                 arr(i, 23) = Replace(.Cell(13, 3).Range.Text, Chr(7), "")
                 arr(i, 24) = Replace(.Cell(14, 2).Range.Text, Chr(7), "")
                 arr(i, 25) = Replace(.Cell(14, 3).Range.Text, Chr(7), "")
                 arr(i, 26) = Replace(.Cell(14, 4).Range.Text, Chr(7), "")
                 arr(i, 27) = Replace(.Cell(15, 2).Range.Text, Chr(7), "")
                 arr(i, 28) = Replace(.Cell(15, 3).Range.Text, Chr(7), "")
                 arr(i, 29) = Replace(.Cell(15, 4).Range.Text, Chr(7), "")
                 arr(i, 30) = Replace(.Cell(16, 2).Range.Text, Chr(7), "")
                 arr(i, 31) = Replace(.Cell(16, 3).Range.Text, Chr(7), "")
                 arr(i, 32) = Replace(.Cell(16, 4).Range.Text, Chr(7), "")
                 arr(i, 33) = Replace(.Cell(19, 1).Range.Text, Chr(7), "") & Replace(.Cell(19, 2).Range.Text, Chr(7), "") _
                   & Replace(.Cell(19, 3).Range.Text, Chr(7), "") & Replace(.Cell(19, 4).Range.Text, Chr(7), "") & Chr(13) _
                   & Replace(.Cell(20, 1).Range.Text, Chr(7), "") & Replace(.Cell(20, 2).Range.Text, Chr(7), "") _
                   & Replace(.Cell(20, 3).Range.Text, Chr(7), "") & Replace(.Cell(20, 4).Range.Text, Chr(7), "")
                 arr(i, 34) = Replace(.Cell(23, 1).Range.Text, Chr(7), "") & Replace(.Cell(23, 2).Range.Text, Chr(7), "") _
                   & Replace(.Cell(23, 3).Range.Text, Chr(7), "") & Replace(.Cell(23, 4).Range.Text, Chr(7), "") _
                   & Replace(.Cell(23, 5).Range.Text, Chr(7), "") & Replace(.Cell(23, 6).Range.Text, Chr(7), "") & Chr(13) _
                   & Replace(.Cell(24, 1).Range.Text, Chr(7), "") & Replace(.Cell(24, 2).Range.Text, Chr(7), "") _
                   & Replace(.Cell(24, 3).Range.Text, Chr(7), "") & Replace(.Cell(24, 4).Range.Text, Chr(7), "") _
                   & Replace(.Cell(24, 5).Range.Text, Chr(7), "") & Replace(.Cell(24, 6).Range.Text, Chr(7), "")
                 arr(i, 35) = Replace(.Cell(29, 1).Range.Text, Chr(7), "")
           
         End With
         Next
         wordD.Close
         cFile = Dir
     Loop
     Set wordD = Nothing
     Wordapp.Quit
     Sheet1.Range("A2").Resize(i, 35) = arr
     Application.ScreenUpdating = True
End Sub

代码这么长,有没有进一步优化的可能?

评分

1

查看全部评分

TA的精华主题

TA的得分主题

 楼主| 发表于 2016-7-27 13:56 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
hhjjpp 发表于 2016-7-27 13:48
居然每个word表的行数都不一致!

谢谢大神出手相救!

TA的精华主题

TA的得分主题

发表于 2017-1-6 16:49 | 显示全部楼层
hhjjpp 发表于 2016-7-27 13:48
居然每个word表的行数都不一致!

hhjjpp老师:如果要将多个个人word信息表汇总到EXCEL表上,应该怎样修改代码,多谢指教。

汇总.rar

35.86 KB, 下载次数: 96

TA的精华主题

TA的得分主题

发表于 2017-1-6 16:58 | 显示全部楼层
dyzx 发表于 2017-1-6 16:49
hhjjpp老师:如果要将多个个人word信息表汇总到EXCEL表上,应该怎样修改代码,多谢指教。

有问题自己开新贴,这样容易得到解决,寄生在别人贴子后面不好。

TA的精华主题

TA的得分主题

发表于 2017-1-6 20:21 | 显示全部楼层
dyzx 发表于 2017-1-6 16:49
hhjjpp老师:如果要将多个个人word信息表汇总到EXCEL表上,应该怎样修改代码,多谢指教。

比葫芦画瓢就行了,很简单的

TA的精华主题

TA的得分主题

发表于 2017-6-5 08:43 | 显示全部楼层
小花鹿 发表于 2017-1-6 20:21
比葫芦画瓢就行了,很简单的

小花鹿老师:请指教,应该怎样修改代码?

TA的精华主题

TA的得分主题

发表于 2017-12-23 07:16 | 显示全部楼层
为什么我一运行就出错?程序定位到 Dim wordD As word.Document 并提示:编译错误:用户定义类型未定义

TA的精华主题

TA的得分主题

 楼主| 发表于 2017-12-23 09:29 | 显示全部楼层
makelot 发表于 2017-12-23 07:16
为什么我一运行就出错?程序定位到 Dim wordD As word.Document 并提示:编译错误:用户定义类型未定义

把出错的附件上传看看。
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-9-29 18:22 , Processed in 0.047131 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表