VBA合并doc文档

2020-05-05 17:15:16  阅读 2301 次 评论 0 条
Sub MergeDocuments()
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

注意:以上仅能合并文件中不超过1页的文件,超过1页。。。请用WPS会员功能进行合并。

本文地址:https://www.wpsds.com/wpswz/161.html
版权声明:本文为原创文章,版权归 达叔 所有,欢迎分享本文,转载请保留出处!

发表评论


表情

还没有留言,还不快点抢沙发?