PageSetup 对象

         
多个对象
PageSetup

代表页面设置说明。PageSetup 对象包含所有页面设置的属性(左边距、底部边距、纸张大小等)。

PageSetup 对象用法

可用 PageSetup 属性返回一个 PageSetup 对象。下例将打印方向设置为横向,并打印工作表。

With Worksheets("Sheet1")
    .PageSetup.Orientation = xlLandscape
    .PrintOut
End With

With 语句使同时设置若干属性变得简单而迅速。下例设置第一张工作表的所有页边距。

With Worksheets(1).PageSetup
    .LeftMargin = Application.InchesToPoints(0.5)
    .RightMargin = Application.InchesToPoints(0.75)
    .TopMargin = Application.InchesToPoints(1.5)
    .BottomMargin = Application.InchesToPoints(1)
    .HeaderMargin = Application.InchesToPoints(0.5)
    .FooterMargin = Application.InchesToPoints(0.5)
End With