PageSetup 对象 (Excel)PageSetup object (Excel)

代表页面设置说明。Represents the page setup description.

注释Remarks

PageSetup 对象包含作为特性的所有页面设置属性(左边距、下边距、纸张大小等)。The PageSetup object contains all page setup attributes (left margin, bottom margin, paper size, and so on) as properties.

示例Example

使用 Worksheet 对象的 PageSetup 属性返回 PageSetup 对象。Use the PageSetup property of the Worksheet object to return a PageSetup object.

以下示例将打印方向设置为横向模式,然后打印工作表。The following example sets the orientation to landscape mode and then prints the worksheet.

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

With 语句使同时设置多个属性变得轻松快速。The With statement makes it easier and faster to set several properties at the same time. 以下示例设置第一张工作表的所有边距。The following example sets all the margins for worksheet one.

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

属性Properties

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.