Page Setup


Dim oSection As Word.Section 
Dim oSection As Word.Section = ActiveDocument.PageSetup

Protected Document

Set oSection = Application.Selection.Sections(1) 
Debug.Print oSection.PageSetup.PageWidth

This will generate an error if the document has protection


You cannot change the following if the document is protected

ActiveDocument.PageSetup.FirstPageTray = wdPrinterPaperCassette 
ActiveDocument.PageSetup.OtherPagesTray =


ActiveDocument.PageSetup.PaperSize = wdPaperSize.wdPaperCustom 


ActiveDocument.PageSetup.PageWidth = 

Settings the pagewidth property automatically changes the Papersize property to wdPaperCustom


With ActiveDocument.PageSetup 
   .LeftMargin = InchesToPoints(0.5)
   .RightMargin = InchesToPoints(0.5)
   .TopMargin = InchesToPoints(0.5)
   .BottomMargin = InchesToPoints(0.5)
   .SetAsTemplateDefault
End With


ActiveDocument.Sections(1).PageSetup.Orientation = wdOrientation.wdOrientLandscape 

From Edge

oSection.PageSetup.HeaderDistance = 
oSection.PageSetup.FooterDistance =


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext