发布网友 发布时间:2022-04-23 00:09
共1个回答
热心网友 时间:2023-10-04 19:38
代码不多,可是费了老劲。亲:一定要及时采纳哟。
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