Appending multiple files to a single Word doc

S

Sally Hurley

I'm looking for a macro or some kind of routine that would append a
directory's worth of Word documents into a single Word document. Page break
between documents would be great, but I guess I could add that in later. I
know this must be a painfully easy script to write - but I don't have time to
play around with the macro to figure it out (gads - I feel guilty asking).
Anyway - does anyone have such a macro or what I'd need to do it?

Thanks
 
S

Steve Lang

Hi Sally,

Here is a quick method

Sub Foo()
Dim i As Long
Application.ScreenUpdating = False
Documents.Add
With Application.FileSearch
'Search in foldername
.LookIn = "C:\test"
.SearchSubFolders = False
.FileName = "*.doc"
.Execute
For i = 1 To .FoundFiles.Count
If InStr(.FoundFiles(i), "~") = 0 Then
Selection.InsertFile FileName:=(.FoundFiles(i)), _
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.InsertBreak Type:=wdPageBreak
End If
Next i
End With
End Sub


HTH and have a great day!

Steve
 
H

Hanashi_Aru

Sally,

I know this thread is a few months old, but did any of the documents you
needed to insert have custom "outline numbering" styles?
 
C

Cheryl B.

Steve's solution worked great ... I have 125 individual Word documents in
which the filename starts with 1, 2, 3, etc.. Is there a way to have the
files appended in filename order so that the pages appear in sequence?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top