我有一个macros为一组选项卡创build单独的PDF。 有没有办法添加一个步骤,并将所有的PDF文件合并成一个文件?

我有一个macros为一组选项卡创build单独的PDF。 有没有办法添加一个步骤,并将所有的PDF文件合并成一个文件?

Sub Print_Exhibit() Dim Numb_Exhibit As Double Dim File_Location As String Dim Sheet_Name As String Dim X As Double Dim Y As Double Numb_Exhibit = WorksheetFunction.Max(Sheets("Control - Exhibit Key").Range("B:B")) File_Location = Sheets("Control - Exhibit Key").Range("K6").Value For X = 1 To Numb_Exhibit Y = 8 + X Sheet_Name = Sheets("Control - Exhibit Key").Range("E" & Y).Value Sheets(Sheet_Name).Select ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=File_Location & "\" & Sheet_Name & ".pdf" _ , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ :=False, OpenAfterPublish:=True Next End Sub 

非常感谢你的帮助!

遍历所有选项卡,复制并粘贴到新的常用选项卡中。 导出它。

在发布之前,您是否先做了Googlesearch?

将多张纸张保存为.pdf

 Public Sub subCreatePDF() If Not IsPDFLibraryInstalled Then 'Better show this as a userform with a proper link: MsgBox "Please install the Addin to export to PDF. You can find it at http://www.microsoft.com/downloads/details.aspx?familyid=4d951911-3e7e-4ae6-b059-a2e79ed87041". Exit Sub End If ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _ Filename:=ActiveWorkbook.Path & Application.PathSeparator & _ ActiveSheet.Name & " für " & Range("SelectedName").Value & ".pdf", _ Quality:=xlQualityStandard, IncludeDocProperties:=True, _ IgnorePrintAreas:=False, OpenAfterPublish:=True End Sub Private Function IsPDFLibraryInstalled() As Boolean 'Credits go to Ron DeBruin (http://www.rondebruin.nl/pdf.htm) IsPDFLibraryInstalled = _ (Dir(Environ("commonprogramfiles") & _ "\Microsoft Shared\OFFICE" & _ Format(Val(Application.Version), "00") & _ "\EXP_PDF.DLL") <> "") End Function 

要么

 ThisWorkbook.Sheets(Array("Sheet1", "Sheet2")).Select ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "C:\tempo.pdf", Quality:= xlQualityStandard, IncludeDocProperties:=True, _ IgnorePrintAreas:=False, OpenAfterPublish:=True 

https://danwagner.co/how-do-i-save-multiple-sheets-as-a-single-pdf/