我在这个网站上做了很多研究,但没有找到解决我问题的方法。我有一个包含多个工作表的工作簿,这些工作簿具有需要打印的特定范围。不幸的是,这些范围需要以非常特定的顺序打印以进行月度报告,并且更容易将它们保存在单独的选项卡上。我创建了一个代码,允许我将它们打印到我的办公室打印机,但我希望能够组合这些纸张,然后将它们直接打印到PDF。谁能帮我吗?如果没有,我可以继续使用打印宏。
谢谢!
问题/思想
1)我能够选择范围,并一次性将所有这些打印成单个pdf吗?
2)如果不是或许它更容易打印到两个不同的pdf(基于制表符/工作表)然后在adobe中组合
这是我的代码:
Sub PrintOut()
Answer = MsgBox("Ahoy scallywag! Would ye like t' print scroll?",
vbYesNoCancel + vbInformation, "Application Message")
If Answer = vbYes Then Else Exit Sub
Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftMargin = Application.CentimetersToPoints(0.5)
.RightMargin = Application.CentimetersToPoints(0.5)
.TopMargin = Application.CentimetersToPoints(0.5)
.BottomMargin = Application.CentimetersToPoints(0.5)
.HeaderMargin = Application.CentimetersToPoints(0.2)
.FooterMargin = Application.CentimetersToPoints(0.2)
Worksheets("PTD and YTD Spend").PageSetup.CenterHorizontally = True
Worksheets("Leasing Detail").PageSetup.CenterHorizontally = True
Worksheets("PTD and YTD Spend").PageSetup.CenterVertically = True
Worksheets("Leasing Detail").PageSetup.CenterVertically = True
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$3:$AG$32"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$3:$AD$32"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$33:$AG$63"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$33:$AD$63"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$64:$AG$93"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$64:$AD$93"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$94:$AG$123"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$94:$AD$123"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$124:$AG$153"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$124:$AD$153"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$154:$AG$183"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$154:$AD$183"
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select
ActiveSheet.PageSetup.PrintArea = "$G$184:$AG$216"
ActiveWindow.SelectedSheets.PrintOut
Sheets("Leasing Detail").Select
ActiveSheet.PageSetup.PrintArea = "$G$184:$AD$213"
ActiveWindow.SelectedSheets.PrintOut
Sheets(Array("PTD and YTD Spend", "Leasing Detail")).Select
ActiveWindow.SelectedSheets.PrintOut
Sheets("PTD and YTD Spend").Select 'Needed so that multiple sheets don't remain selected
End With
Application.ScreenUpdating = True
End Sub
答案 0 :(得分:0)
您可以使用两种替代策略:
或
答案 1 :(得分:0)
这个选项怎么样?
x
我非常确定有多种方法可以自定义和/或增强它。