Appending word documents - Part 2

C

Cheryl B.

Steve's solution (copy/pasted below) worked great ... however, (question 1) I
seem to be getting some duplicate pages. I have 125 individual Word
documents in which the filename starts with 1, 2, 3, etc.. (question 2)Is
there a way to have the files appended in filename order so that the pages
appear in sequence?

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
 

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