![]() |
|
|
|
#1
|
|||
|
|||
|
I need code for Merge multiple header into one word file. Help me for the same.
I have mentioned the below code is for merge multiple word file into one. Code:
Sub MergeMultiDocsIntoOne()
Dim dlgFile As FileDialog
Dim nTotalFiles As Integer
Dim nEachSelectedFile As Integer
Set dlgFile = Application.FileDialog(msoFileDialogFilePicker)
With dlgFile
.AllowMultiSelect = True
If .Show <> -1 Then
Exit Sub
Else
nTotalFiles = .SelectedItems.Count
End If
End With
For nEachSelectedFile = 1 To nTotalFiles
Selection.InsertFile dlgFile.SelectedItems.Item(nEachSelectedFile)
If nEachSelectedFile < nTotalFiles Then
Selection.InsertBreak Type:=wdPageBreak
Else
If nEachSelectedFile = nTotalFiles Then
Exit Sub
End If
End If
Next nEachSelectedFile
End Sub
Last edited by macropod; 06-10-2020 at 03:43 PM. Reason: Added code tags |
|
#2
|
||||
|
||||
|
See the Combine Multiple Word Documents 'Sticky' thread at the top of this forum: https://www.msofficeforums.com/word-...documents.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
||||
|
||||
|
Cross-posted at: How to merge multiple header into one word file - Stack Overflow
For cross-posting etiquette, please read: Excelguru Help Site - A message to forum cross posters
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Mail Merge: Using One Excel File with Multiple Sheets
|
Townshend | Mail Merge | 19 | 06-25-2021 12:39 AM |
| Extract Document ID and description from header in multiple Word documents and paste in new word doc | venkat_m | Word VBA | 2 | 05-23-2020 03:57 AM |
Replace specific word inside a table in the Header with Merge field
|
Turin74 | Word VBA | 3 | 06-06-2019 06:17 PM |
Merge one Excel file into multiple Word Documents
|
Rushpac | Mail Merge | 2 | 01-27-2017 02:49 PM |
| Mail Merge using Word 2010 - Header source not be recognized | Gage262 | Word | 8 | 02-01-2012 11:08 AM |