This example changes the page orientation for the active document.
ActiveDocument.PageSetup.TogglePortrait
This example changes the page orientation for all the sections in the selection. If the initial orientation of each section is not the same as the orientation of the other sections, an error occurs.
Selection.PageSetup.TogglePortrait