I'm trying to convert each excel tab to a pdf using the pdf distiller. I am able to create some of the pdfs, but I get an error and it doesn't create all of the pdfs.
I get the following error message:
"do not send fonts to distiller"
Even though I have it unchecked in the properties. Like I metioned it does create some of the pdfs, but then errors out and doesn't finish.
Here is my code:
'convert to pdfs
Dim pdfDist As New ACRODISTXLib.PdfDistiller
Dim OriginalPrinter, PDFPrinter As String
Dim sName, PSFileName, PDFFileName As String
Dim s As Worksheet
Dim fs As Object
Set fs = CreateObject("Scripting.Fi
leSystemOb
ject") 'Good old FSO
'Identify printers
OriginalPrinter = Application.Printer.Device
Name 'Application.ActivePrinter
'MsgBox OriginalPrinter
PDFPrinter = "Adobe PDF on Ne01:" 'Change this to suit the Acrobat Distiller printer
'Cycle through each sheet, retrieves sheet name and generate PS file in selected folder
For Each s In oWB.Worksheets
sName = s.Name 'Sheet name
If sName = "Access" Then GoTo MoveOn 'Here you can identify sheets you don't want printed
PSFileName = DLookup("[ExcelTemplatePat
h]", "tblSetup") & "\" & strOrderID & "\" & sName & ".PS" 'Converts sheet name to file path
PDFFileName = Left(PSFileName, Len(PSFileName) - 2) & "PDF"
'Print to PS file in nominated folder
s.PrintOut Copies:=1, preview:=False, ActivePrinter:=PDFPrinter,
printtofile:=True, collate:=True, prtofilename:=PSFileName
'Convert PS to PDF using the method from PDFDistiller class
pdfDist.FileToPDF PSFileName, PDFFileName, ""
MoveOn:
Next s
Set pdfDist = Nothing 'Clears the pipes
'Waits until last PDF has been processed then trashes PS & LOG files
Do Until fs.FileExists(PDFFileName)
Loop
fs.DeleteFile DLookup("[ExcelTemplatePat
h]", "tblSetup") & "\" & strOrderID & "\*.PS"
fs.DeleteFile DLookup("[ExcelTemplatePat
h]", "tblSetup") & "\" & strOrderID & "\*.LOG"
Application.Printer = OriginalPrinter 'Resets to original printer selection in Excel