I inherited a macro at work that combined 16 word documents into one document at my office. Each document has a unique header. Prior to Office 365, this worked fine. Since the upgrade, the headers are no longer unique. The header of the first document is now on all subsequent documents. Below is the code, which I shortened to show just 3 documents being merged, as my original code merges 16 documents. Additionally, it doesn't make any difference if I alter the code for the "docx" format or use the "doc" format. I can somewhat understand what the code does, but I struggle trying to write code. Can anyone please offer some insight on how I can fix this problem? Thanks.
Code:
Sub MergeDocs()
'
Documents.AddDocumentType:=wdNewBlankDocument
IfSelection.PageSetup.Orientation = wdOrientPortrait Then
Selection.PageSetup.Orientation = wdOrientLandscape
Else
Selection.PageSetup.Orientation = wdOrientPortrait
End If
With Selection.PageSetup
.LineNumbering.Active =False
.Orientation =wdOrientLandscape
.TopMargin =InchesToPoints(0.25)
.BottomMargin = InchesToPoints(0.25)
.LeftMargin =InchesToPoints(0.25)
.RightMargin =InchesToPoints(0.2)
.Gutter =InchesToPoints(0)
.HeaderDistance =InchesToPoints(0.5)
.FooterDistance =InchesToPoints(0.5)
.PageWidth =InchesToPoints(11)
.PageHeight =InchesToPoints(8.5)
.FirstPageTray =wdPrinterDefaultBin
.OtherPagesTray =wdPrinterDefaultBin
.SectionStart =wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment =wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting =False
.BookFoldPrintingSheets =1
.GutterPos =wdGutterPosLeft
End With
ChangeFileOpenDirectory"C:\Document\Files"
Selection.InsertFileFileName:= _
"C:\Document\Files\1Percent.docx", Range:="", _
ConfirmConversions:=False,Link:=False, Attachment:=False
Selection.InsertBreakType:=wdPageBreak
ChangeFileOpenDirectory"C:\Document\Files"
Selection.InsertFileFileName:= _
"C:\Document\Files\2SPLY.docx", Range:="", _
ConfirmConversions:=False,Link:=False, Attachment:=False
Selection.InsertBreakType:=wdPageBreak
ChangeFileOpenDirectory"C:\Document\Files"
Selection.InsertFileFileName:= _
"C:\Document\Files\3Variance.docx", Range:="", _
ConfirmConversions:=False,Link:=False, Attachment:=False
Selection.InsertBreakType:=wdPageBreak
Selection.HomeKeyUnit:=wdStory
ActiveDocument.SaveAs2FileName:= _
"C:\Document\Report\FinalReport.docx", FileFormat:= _
wdFormatDocument,LockComments:=False, Password:="", AddToRecentFiles:= _
True,WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False,SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False,CompatibilityMode:=0
End Sub