Option Explicit
Sub 打印加工单页面配置(BM As String)
' 打印加工单 宏
' 快捷键: Ctrl+Shift+P
'Dim savedRecords '记录pagesetup配置
Dim sheetName As Worksheet
Set sheetName = ThisWorkbook.Worksheets(BM)
'--------工作表选择--------
Worksheets("SheetName").Select '打印指定工作表
'--------打印设置--------
With ActiveSheet.PageSetup
.PrintArea = "" ' 打印整个工作表
.Orientation = xlLandscape '页面方向设置为横向
.PaperSize = xlPaperA4 ' 纸张大小设置为A4纸
'--------边距缩放设置--------1磅等于0.035厘米
.TopMargin = 1.9 / 0.035 '上下间距 1.9cm
.BottomMargin = 1.9 / 0.035
.LeftMargin = 1.8 / 0.035 '左右间距 1.8cm
.RightMargin = 1.8 / 0.035
.HeaderMargin = 0.8 / 0.035 '眉脚间距 0.8cm
.FooterMargin = 0.8 / 0.035
.Zoom = 100 '无缩放
End With
'savedRecords = ActiveSheet.PageSetup.Records
'--------打印--------
ActiveSheet.PageSetup.Records = savedRecords
End Sub
Sub 打印所有加工单()
打印加工单页面配置 ("Excel")
ActiveSheet.PrintOut copies:=2, ActivePrinter:="Fax 在 Ne03:"
End Sub
标签:--------,End,Sub,打印,ActiveSheet,工作,0.035 From: https://www.cnblogs.com/YYZYCS/p/17524355.html