Hi I am trying to use the below macro with MSO 03 and Adobe distiller 8.0. it works fine until it comes to Dim mypdfDist As New PdfDistiller when it returns an error "User-defined type not defined".
Woudl anyone be able to tell me how I can resolve this as for Adobe distiller 6.0 it work perfectly fine.
Thank you in advance
Woudl anyone be able to tell me how I can resolve this as for Adobe distiller 6.0 it work perfectly fine.
Code:
Option Explicit
Sub PDF_Sheets()
' This will loop through the worksheets in the workbook
' and print each one to a pdf file
Dim wsEachSheet As Worksheet
For Each wsEachSheet In ThisWorkbook.Worksheets
Call Create_PDF(wsEachSheet)
Next wsEachSheet
End Sub
Sub Create_PDF(wsPrint_Sheet As Worksheet)
Dim tempPDFFileName As String
Dim tempPSFileName As String
Dim tempPDFRawFileName As String
Dim tempLogFileName As String
tempPDFRawFileName = "C:\" & wsPrint_Sheet.Name
tempPSFileName = tempPDFRawFileName & ".ps"
tempPDFFileName = tempPDFRawFileName & ".pdf"
tempLogFileName = tempPDFRawFileName & ".log"
'Prints worksheet as a pdf
wsPrint_Sheet.PrintOut Copies:=1, preview:=False, ActivePrinter:="Adobe PDF", _
printtofile:=True, Collate:=True, prtofilename:=tempPSFileName
Dim mypdfDist As New PdfDistiller
mypdfDist.FileToPDF tempPSFileName, tempPDFFileName, ""
Kill tempPSFileName
Kill tempLogFileName
End Sub
Thank you in advance