EXCEL如何自适应纸张打印
来源:百度知道 编辑:UC知道 时间:2024/05/23 14:54:46
用vba代码可以实现excel自适应打印
Sub test()
With ActiveSheet
With .PageSetup '设置打印信息
.FitToPagesWide = 1 '自动适应页宽
.FitToPagesTall = 1 '自动适应页高
.CenterHorizontally = True '水平居中
.CenterVertically = True '垂直居中
.Orientation = xlLandscape '纸张方向横向
.PrintArea = "A1:O33" '打印范围
End With
.PrintOut '打印当前设置的页面
With .PageSetup
.Orientation = xlPortrait '纸张方向纵向
.PrintArea = "A35:K77" '设置打印范围
End With
.PrintOut '打印当前设置的页面
With .PageSetup
.Orientation = xlLandscape '纸张方向横向
.PrintArea = "A80:N106" '设置打印范围
End With
.PrintOut '打印当前设置的页面
.PageSetup.PrintArea = "" '清空打印区域
End With
End Sub
解决方法: