第1个回答 2011-02-20
这个都可以用宏来设置的,比如:
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"
再示例
设置四个边界、页眉边界、页脚边界、纸张、打印缩放比例:
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.787)
.RightMargin = Application.InchesToPoints(1.181)
.TopMargin = Application.InchesToPoints(0.393)
.BottomMargin = Application.InchesToPoints(1.574)
.HeaderMargin = Application.InchesToPoints(0.511)
.FooterMargin = Application.InchesToPoints(0.905)
.PaperSize = xlPaperEnvelopeB5 '用B5纸
.Zoom = 95 '缩小到95%打印
End With
Good luck!