全部显示

RightMargin 属性

       

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

说明

边距的设置和返回均以磅为单位。可使用 InchesToPoints 方法进行英寸到磅值的转换,也可使用 CentimetersToPoints 方法进行厘米到磅值的转换。

示例

本示例将 Sheet1 的右边距设为 1.5 英寸。

Worksheets("Sheet1").PageSetup.RightMargin = _
        Application.InchesToPoints(1.5)

本示例将 Sheet1 的右边距设为 2 厘米。

Worksheets("Sheet1").PageSetup.RightMargin = _
        Application.CentimetersToPoints(2)

本示例显示 Sheet1 中右边距的当前设定值。

marginInches = Worksheets("Sheet1").PageSetup.RightMargin / _
    Application.InchesToPoints(1)
MsgBox "The current right margin is " & marginInches & " inches"