- ·上一篇:word里如何把小方块涂黑
- ·下一篇:word里英文字体如何改
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。
