chu10 發表於 2011-12-26 14:46:32

chu10's 倉庫

本帖最後由 chu10 於 2011-12-26 14:47 編輯

How to Combine Multiple Word Documents into One Document
All you need to do is setup this simple Microsoft Word macro to merge many Word documents into a single Word document.
.
Sub MergeDocs()
    Dim rng As Range
    Dim MainDoc As Document
    Dim strFile As String
    Const strFolder = "C:\Book\Chapters\" 'change to suit
    Set MainDoc = Documents.Add
    strFile = Dir$(strFolder & "*.doc") ' can change to .docx(chu10按:任何Word 可以開的檔案大概都可以,試過rtf是ok的)
    Do Until strFile = ""
      Set rng = MainDoc.Range
      rng.Collapse wdCollapseEnd
      rng.InsertFile strFolder & strFile
      strFile = Dir$()
    Loop
End Sub
.

自 http://www.gaebler.com/How-to-Combine-Multiple-Word-Documents-into-One-Document.htm
頁: [1]
查看完整版本: chu10's 倉庫