![]() |
excel/vba & acrobat 7.0 pro - Print multiple sheets to 1 PDF
Hi all,
I was wondering how i would go about modifying the code i have below so that i can print multiple sheets to a single PDF file with each worksheet printed being a different tab. (if that last part isn't possible, then 1 pdf file with each page being a separate sheet from the workbook.) Note: my workbook has 15 sheets, only 1 sheet is visible at a time. the print function will unhide/hide the sheets so that they can be printed with the code below. (not all 15 sheets will be printed to pdf, only 4) here is the code i am using to print to a pdf file: If printToPDF And (pageID(i) = "Invoice" Or pageID(i) = "Withdrawls" Or pageID(i) = "Deposits" Or pageID(i) = "Sales Journal" Or pageID(i) = "Summary" Or pageID(i) = "Inventory Costs") Then pb.Caption3 = "Printing" & pageID(i) Set myPDF = New PdfDistiller PSfilename = path & "temp.ps" If pageID(i) = "Invoice" Then PDFfilename = path & order & ".pdf" Else PDFfilename = path & pageID(i + 2) & " " & Year(Date) & ".pdf" End If ActiveWindow.SelectedSheets.PrintOut copies:=1, ActivePrinter:=ChoosePrinter(pdfPrinter), preview:=False, printtofile:=True, collate:=True, prtofilename:=PSfilename pb.Caption3 = "Converting to PDF...." myPDF.FileToPDF PSfilename, PDFfilename, "" Kill PSfilename On Error Resume Next Kill path & "*.log" On Error GoTo 0 Set myPDF = Nothing End If i have tried printing each sheet to a .ps file and then using mypdf.filetopdf to convert it, but i haven't been able to get it to accept multiple input names. If you need my entire printdocuments sub, let me know and i'll paste that tia! J |
All times are GMT +1. The time now is 07:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com