I'M trying to print/export or save all my tabs in an excel workbook as one PDF document.
我正在尝试打印/导出或保存我的所有标签在一个excel工作簿作为一个PDF文档。
The number of tabs could be any number and could be named anything.
选项卡的数量可以是任意数字,可以被命名为任何东西。
I have the following piece of code:
我有以下代码:
ThisWorkbook.Sheets(Array("Sheet1", "Sheet2")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\tempo.pdf", Quality:= xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
But this obviously requires the number of sheets and the exact names of the sheets. Is there a way to maybe count the number of sheets in a workbook and print all of these to PDF as one PDF doc?
但这显然需要床单的数量和确切的名字。是否有一种方法可以计算工作簿中的表格数量并将所有这些打印成PDF文档?
Please can someone show me how to do this? Thanks in advance
谁能告诉我怎么做这件事吗?谢谢提前
1 个解决方案
#1
1
Simply use ThisWorkbook.ExportAsFixedFormat or ActiveWorkbook.ExportAsFixedFormat
简单地使用ThisWorkbook。ExportAsFixedFormat或ActiveWorkbook.ExportAsFixedFormat
Option Explicit
Public Sub Example()
ThisWorkbook.ExportAsFixedFormat _
Type:=xlTypePDF, _
FileName:="C:\tempo.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub
Workbook.ExportAsFixedFormat Method (Excel)
工作簿。ExportAsFixedFormat方法(Excel)
#1
1
Simply use ThisWorkbook.ExportAsFixedFormat or ActiveWorkbook.ExportAsFixedFormat
简单地使用ThisWorkbook。ExportAsFixedFormat或ActiveWorkbook.ExportAsFixedFormat
Option Explicit
Public Sub Example()
ThisWorkbook.ExportAsFixedFormat _
Type:=xlTypePDF, _
FileName:="C:\tempo.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub
Workbook.ExportAsFixedFormat Method (Excel)
工作簿。ExportAsFixedFormat方法(Excel)