PageSetup.TopMargin 属性 (Excel)

返回或设置上边距的大小(以 为单位)。 读/写 Double

语法

表达式TopMargin

表达 一个代表 PageSetup 对象的变量。

备注

边距的设置和返回均以磅为单位。 使用 InchesToPoints 方法或 CentimetersToPoints 方法执行转换。

示例

下列两个示例均将 Sheet1 的上边距设置为 0.5 英寸(36 磅)。

Worksheets("Sheet1").PageSetup.TopMargin = _ 
 Application.InchesToPoints(0.5) 
 
Worksheets("Sheet1").PageSetup.TopMargin = 36

本示例显示上边距的当前设置值。

marginInches = ActiveSheet.PageSetup.TopMargin / _ 
 Application.InchesToPoints(1) 
MsgBox "The current top margin is " & marginInches & " inches"

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。