excel宏编程如何对打印机进行设置,打印纸张,宽度,高度?

默认分类 未结 1 1454
0七夜听雪0
0七夜听雪0 2023-03-20 21:39
1条回答
  • 2023-03-20 22:12

    这个都可以用宏来设置的,比如: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"Thecurrentleftmarginis"&marginInches&"inches"再示例设置四个边界、页眉边界、页脚边界、纸张、打印缩放比例:WithActiveSheet.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%打印EndWithGoodluck!

    0 讨论(0)
提交回复