有时候需要将word文档合并为1个文档,代码如下:

Sub 合并文档() Application.ScreenUpdating = False MyPath = ActiveDocument.Path MyName = Dir(MyPath & "" & ".doc*") 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 Loop Application.ScreenUpdating = True End Sub

有合并,就有拆分,下次分享拆分代码。。。。