全部显示

TopMargin 属性

       

为单位返回或设置上边距的大小。Double 类型,可读写。

说明

边距的设置和返回均以磅为单位。可使用 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"