Printing to PDF

AlexMach

New Member
Joined
Apr 6, 2009
Messages
17
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.


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
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top