本帖最后由 yuze0804007 于 2020-6-12 19:14 编辑
vba code:
[Visual Basic] 纯文本查看 复制代码 Sub MergeDocuments()
Application.ScreenUpdating = False
MyPath = ActiveDocument.Path
MyName = Dir(MyPath & "\" & "*.*")
i = 0
Do While MyName <> ""
If MyName <> ActiveDocument.Name Then
Set wb = Documents.Open(MyPath & "\" & MyName)
Selection.WholeStory
Selection.Copy
Windows(1).Activate
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.Paste
i = i + 1
wb.Close False
End If
MyName = Dir
DoEvents
Loop
Application.ScreenUpdating = True
End Sub
蓝奏链接:https://wwa.lanzouj.com/iRFXtdlf5qf
要把所有doc和docx放在同一文件夹下 |