On my position we are likely to format check documents that contain numerous sections due to change of page orientation. There are given restrictions on what should be the dimensions of margins size for Portrait and Landscape orientation. What I want to achieve is a macro that would go through the currently opened document, check the orientation of each of the sections and adjust the Margins/Headers/Paper Size (which are different depending on whether the page is portrait or landscape) Here is what I got so far, but it does only change the Margins to ones from Landscape setup and disregards the header/footer:
If PageSetup.Orientation = wdOrientPortrait Then
PageSetup.LeftMargin = CentimetersToPoints(3.17)
PageSetup.RightMargin = CentimetersToPoints(3.17)
PageSetup.TopMargin = CentimetersToPoints(2.23)
PageSetup.BottomMargin = CentimetersToPoints(2.21)
PageSetup.PaperSize = wdPaperLetter
PageSetup.HeaderDistance = CentimetersToPoints(0.96)
PageSetup.FooterDistance = CentimetersToPoints(0.94)
ElseIf PageSetup.Orientation = wdLandscapeOrientation Then
PageSetup.LeftMargin = CentimetersToPoints(2.21)
PageSetup.RightMargin = CentimetersToPoints(2.23)
PageSetup.TopMargin = CentimetersToPoints(3.17)
PageSetup.BottomMargin = CentimetersToPoints(3.17)
PageSetup.PaperSize = wdPaperLetter
PageSetup.HeaderDistance = CentimetersToPoints(1.9)
PageSetup.FooterDistance = CentimetersToPoints(1.9)
End If
Selection.GoToNext wdGoToSection
Can you help me out with some examples or working code? The above shows my concept in the most simple way, but tbh I have no experience with creating word macros.