全部显示

LeftMargin 属性

       

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

说明

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

示例

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

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

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

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

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

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