Professional Documents
Culture Documents
A dialog will appear, from Save as type, click Word Macro-Enabled Template and click Save.
We will be using VB editor, so first we need to make Developer tab apparent on Word window. In case
you don’t find Developer tab, go to File menu, click Options, and in left pane click Customize Ribbon,
from right pane enable Developer check-box. Click OK to to see Developer tab on the ribbon.
You will reach VB Editor dialog, from left sidebar double-click ThisDocument to open it’s VB editing
window. You will see the code window on the right side. Now put these lines of code in it.
Note: Don’t forget to change the path of the folder where the documents are residing and version of
Word documents in these lines of code. To make it easier we have added this precaution in front of the
codes as well.
Sub MergeDocs()
Dim rng As Range
Dim MainDoc As Document
Dim strFile As String
Const strFolder = “C:\Users\Usman Javaid\Desktop\Word documents\” ||| (Change the path where
your documents are residing)
Set MainDoc = Documents.Add
strFile = Dir$(strFolder & “*.docx”) ||| (Change file extension to .doc incase you are dealing with
Word 97-03 version)
Do Until strFile = “”
Set rng = MainDoc.Range
rng.Collapse wdCollapseEnd
rng.InsertFile strFolder & strFile
strFile = Dir$()
Loop
End Sub
Now press Ctrl+S to save the newly added macro and close the VB editor. Navigate to Developer tab
and click Macros.
From the Macros dialog, select MergeDocs macro and click Run.
If you have specified path and version correctly, then all documents would merge and open-up in a new
document.
You can also check out our previously reviewed guides on Return to last line edited in Word 2010 and
using Mail Merge in Word 2010.