DQ NO.1 - dragon quest fans club

熱搜: 活動 交友 discuz
查看: 2421|回復: 0

[自言自語] chu10's 倉庫

發表於 2011-12-26 14:46:32 | 顯示全部樓層 |閱讀模式
本帖最後由 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$()
End Sub

您需要登錄後才可以回帖 登錄 | 加入成為夥伴


Archiver|手機版|ぱふぱふ屋|DQ NO.1

GMT+8, 2019-6-16 04:37 , Processed in 0.061585 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回復 返回頂部 返回列表