Setting Margins

Set the margins for your document by setting the LeftMargin, RightMargin, TopMargin, or BottomMargin property of the PageSetup object for the document, as shown in the following example:

oDocument.PageSetup.LeftMargin = InchesToPoints(0.5) oDocument.PageSetup.RightMargin = InchesToPoints(0.5) oDocument.PageSetup.TopMargin = InchesToPoints(0.5) oDocument.PageSetup.BottomMargin = InchesToPoints(0.5)

■ Note The value supplied to the XXXMargin properties must be in points. If you want to supply the values in inches (as in the example) you'll need to convert the values to points using the built-in VBA function InchesToPoints.

0 0

Post a comment