
word
Dim fs As FileSearch, i As Long, n As LongSet fs = Application.FileSearchml = ActiveDocument.Pathbwj = ActiveDocument.NameDocuments.AddWith fs .NewSearch .LookIn = ml .FileType = msoFileTypewordDocuments If .Execute 0 Then For i = 1 To .FoundFiles.Count If .FoundFiles.Item(i) ml & & bwj Then Selection.InsertFile FileName:=.FoundFiles.Item(i) Selection.InsertBreak Type:=wdPageBreak n = n + 1 End If Next End IfEnd WithMsgBox 共合并了 & n & 篇文档
把这个代码保存为Sub test。没有这个文件的话,你就没法一次选多个文档插入。2. 新建一个文件夹,把Sub test放进去,再把所有要合并的word文档也放进这个文件夹。3. 打开word,点击顶部菜单的插入选项卡,然后找到对象按钮旁边的箭头,点击它,在弹出的菜单里选择文件中的文字。4. 在弹出的插入文件窗口里,打开你新建的那个文件夹,按住Shift键,全选所有要合并的文档。5. 点击插入按钮,这些文档就会被插入到一个新文档里,合并搞定!
Copyright © 2025 IZhiDa.com All Rights Reserved.
知答 版权所有 粤ICP备2023042255号