当前位置:首页经验技巧Office经验office汇总

word中如何从中提取文件

2026-01-07 12:05:40

1.如何从word文件中提取所有word文档对象

代码不多,可是费了老劲。

亲:一定要及时采纳哟。 Sub a() '导出OLE里的文档 Dim strPath$, strTopic$, intCount%, intEnt%, OActdOC strPath = ActiveDocument.Path & "\" Set OActdOC = ActiveDocument intCount = ActiveDocument.InlineShapes.Count If intCount = 0 Then Exit Sub For cx = 1 To intCount With OActdOC.InlineShapes(cx).OLEFormat If InStr(UCase(Format(.ClassType)), "WORD.DOCUMENT") <> 0 Then With .Object strTopic = Trim(.Paragraphs(1).Range.Text) intEnt = InStr(strTopic, Chr(13)) - 1 strTopic = Left(strTopic, intEnt) If Len(strTopic) > 200 Then strTopic = Left(strTopic, 30) '如果出错,则是内嵌文件第一段里有不适用于文件名的字符,可用正则排除,本人不熟 .SaveAs strPath + strTopic End With End If End With Next End Sub。


免责声明:本站信息来自网络收集及网友投稿,仅供参考,如果有错误请反馈给我们更正,对文中内容的真实性和完整性本站不提供任何保证,不承但任何责任,谢谢您的合作。
版权所有:五学知识网 Copyright © 2015-2026 www.z8000w.com. All Rights Reserved .