|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
大神帮忙看下,划线部分的代码修改一下,现在是运行后当前文件名称会变调,怎么修改一下 使当前文件名字不改变
Sub 按钮打印订单_Click()
PT = "C:\Users\dell\Desktop\"
Application.DisplayAlerts = False
print_1 = ActiveSheet.PageSetup.PrintArea
r1 = Range(ActiveSheet.PageSetup.PrintArea).Rows.Count / ActiveSheet.PageSetup.Pages.Count
r = ActiveSheet.Range("a" & Rows.Count).End(xlUp).Row
c = Application.WorksheetFunction.RoundUp(r / r1, 0)
ActiveSheet.PageSetup.PrintArea = "$A$1" & ":" & "$M$" & c * 25
ActiveSheet.PrintOut PrintToFile:=True, PrToFileName:=PT & Sheets("订单模板").Range("K2").Value & Sheets("订单模板").Range("b2").Value & "采购订单.PDF"
ActiveSheet.PageSetup.PrintArea = print_1
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=PT & Sheets("订单模板").Range("K2").Value & Sheets("订单模板").Range("b2").Value & "采购订单.xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub
|
|