![]() |
#2
|
||||
|
||||
![]()
Use the filepicker instead (below) - or see Insert a selection of documents
Code:
Sub MergeDocs() Dim rng As Range Dim MainDoc As Document Dim strFile As String Dim Count As Long With Application.FileDialog(msoFileDialogFilePicker) .Title = "Pick files" .AllowMultiSelect = True If .Show <> -1 Then Exit Sub Set MainDoc = Documents.Add For Count = 1 To .SelectedItems.Count strFile = .SelectedItems(Count) Set rng = MainDoc.Range With rng .Collapse wdCollapseEnd If Count > 1 Then .InsertBreak wdSectionBreakNextPage .End = MainDoc.Range.End .Collapse wdCollapseEnd End If .InsertFile strFile End With Next Count End With MsgBox ("Files are merged") lbl_Exit: Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
jesselscott | Word | 1 | 04-28-2015 09:55 AM |
Combining Word Documents with Comments | kimmers41 | Word | 0 | 05-06-2014 12:56 PM |
Combining/merging documents | hawkeyefxr | Word | 11 | 08-03-2012 03:01 AM |
![]() |
Blaie | Word | 1 | 06-04-2011 06:35 PM |
![]() |
dms997 | Word | 5 | 02-26-2011 03:25 AM |