Saturday, September 10, 2016

How to merge 2 or more MS word documents

How to merge 2 or more MS word documents. You can do this by manually copying the first file and pasting on to the second file. But if you have too many files to merge and if you have to do it repeatedly, its better to have automated setup.

Below macro will help you to merge 2 documents. You can edit the VBA code and add more files if you want. After merging, it will save as a new document. By default it will save the new merged file under My Documents. If you want the new files to be saved under a specific location, you can mention that the file name section

Sub Merge_2_files()

' Merge 2 files and save as a new document
NewFileName = "NewFile_" & Minute(Now) & "_" & Second(Now) & ".docx"

    Selection.EndKey Unit:=wdStory
    Selection.InsertFile FileName:="C:\Users\inksanjeev\Desktop\A folder\Specifications.docx", Range:="", _
        ConfirmConversions:=False, Link:=False, Attachment:=False
    ActiveDocument.SaveAs2 FileName:=NewFileName, FileFormat:= _
        wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles _
        :=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _
        :=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
        SaveAsAOCELetter:=False, CompatibilityMode:=15
End Sub

Download the files
File 1

File 2

1 comment:

  1. Dell Technical Support Phone Number Dell help phone number for troubleshoot Dell problems for Computer, Laptop, Printers, we help to resolve quickly our services USA and Canada .