Sub Create_PDF()
'Dom Hill, June 2008
'This code has only been tested with Adobe Acrobat 6.0 Professional
'For this code to work the Adobe Distiller VBA library must be enabled
'Select Tools...References in the VBA editor and check it from the list
Dim tempPDFFileName As String
Dim tempPSFileName As String
Dim tempPDFRawFileName As String
Dim tempLogFileName As String
'define file name and path in subdirectory of file where code workbook
'is stored called 'Print Jobs' and picks file name up from a cell
'named as a named range called 'File_Name'
tempPDFRawFileName = ThisWorkbook.Path & "\Print Jobs\" & Range("File_Name")
tempPSFileName = tempPDFRawFileName & ".ps"
tempPDFFileName = tempPDFRawFileName & ".pdf"
tempLogFileName = tempPDFRawFileName & ".log"
'Prints worksheet 'Output' as a pdf, an array of sheets can be printed if required
Sheets("Output").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
Bookmarks