Imprimir varias hojas de excel en PDF creator

Quisiera imprimir en PDF con un solo botón en pdfcreator varias hojas de un solo archivo y luego guardarlo el libro de excel, pero no he podido solo me imprime la hoja PtoInc mi programación va hasta ahí :

Dim pdfjob As PDFCreator.clsPDFCreator
Dim sPDFName As String
Dim sPDFPath As String
Dim Fecha1 As String
Dim Fecha1Dia As Integer
Dim Fecha1Mes As Integer
Dim Fecha1Año As String
Dim Hoja As Variant
Dim Archivo As String
Dim ArchivoOri As String
Sub PrintToPDF_Early()

Fecha1 = Worksheets("PRINCIPAL").Cells(14, 8).Value
Fecha1Dia = Day(Fecha1)
Fecha1Mes = Month(Fecha1)
Fecha1Mes2 = Format(Fecha1, "mmmm")
Fecha1Año = Year(Fecha1)
Hoja = Fecha1Dia & "-" & Fecha1Mes & "-" & Fecha1Año
Archivo = "SPC-PISCO-" & Hoja & ".XLS"
ArchivoOri = ThisWorkbook.Name
sPDFPath = "C:\Users\lcaceres\Desktop\Pto Incipiente Inundacion\"

'Check if worksheet is empty and exit if so
If IsEmpty(ActiveSheet.UsedRange) Then Exit Sub

Set pdfjob = New PDFCreator.clsPDFCreator

With pdfjob
If .cStart("/NoProcessingAtStartup") = False Then
MsgBox "Can't initialize PDFCreator.", vbCritical + _
vbOKOnly, "PrtPDFCreator"
Exit Sub
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = Archivo
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
Sheets("Fracc 1").Select
Range("A1:O162").Select
'Selection.PrintOut copies:=1, collate:=True
Sheets("Topp 1").Select
Range("A1:L72").Select
'Selection.PrintOut copies:=1, collate:=True
Sheets("Sum. Pta.1 y MAP-5010").Select
Range("A1:P86").Select
'Selection.PrintOut copies:=1, collate:=True
Sheets("PtoInc 1").Select
Range("A1:O94").Select
'Selection.PrintOut copies:=1, collate:=True
Sheets(Array("Fracc 1", "Topp 1", "Sum. Pta.1 y MAP-5010", "PtoInc 1")).Select
Sheets("Fracc 1").Activate

'Print the document to PDF
Application.ActivePrinter = "PDFCreator on Ne00:"
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=5, copies:=1, ActivePrinter:="PDFCreator on Ne00:", collate:=True
Sheets("PRINCIPAL").Select

'Wait until the print job has entered the print queue
Do Until pdfjob.cCountOfPrintjobs = 1
DoEvents
Loop
pdfjob.cPrinterStop = False

'Wait until PDF creator is finished then release the objects
Do Until pdfjob.cCountOfPrintjobs = 0
DoEvents
Loop
pdfjob.cClose
' pdfjob.cSendMail("Mi hoja", Sent) = 1
' pdfjob.Copy.SendMail "[email protected]", "Mi Hoja"
'
Set pdfjob = Nothing
Call guardarhoja
ActiveWorkbook.Close
End Sub

Añade tu respuesta

Haz clic para o