whi*_*hiz 5 merge ms-word ms-office
我需要将大量的Word文件合并(加入)到一个文件中,并且使用Word合并(一个接一个)将非常耗时.您是否经历过任何可以处理这项工作的工具?
Sub MergeAllDocuments(AllDocumentsPath as String, MasterDocumentPath as String)
Dim MasterDocument As Document
Set MasterDocument = Documents.Open(FileName:=MasterDocumentPath)
TheDocumentPath = Dir(AllDocumentsPath , vbNormal)
While TheDocumentPath <> ""
' Append the next doc to the end of the master doc. (The
' special "\EndOfDoc" bookmark is always available!)
MasterDocument.Bookmarks("\EndOfDoc").Range.InsertFile TheDocumentPath
TheDocumentPath = Dir
Wend
MasterDocument.Save
End Sub
MergeAllDocuments "C:\MySeparateDocuments\*.doc", "C:\MasterDocument.doc"
Run Code Online (Sandbox Code Playgroud)
我有一个问题 - 为什么你想做这样的事情(至少有“大量”文件)?
| 归档时间: |
|
| 查看次数: |
5531 次 |
| 最近记录: |