Supercharge your PowerPoint Productivity with

Supercharge your PPT Productivity with PPTools

Click here to learn how

Control Distiller from VB/VBA

If you want to invoke Distiller from VB/VBA, read this PDF from Brook House Digital Publishing Solutions, where you'll also find BatchPrintPDF, PDF Assistant and several interesting-looking plug-ins.

If that link doesn't work, try this instead

There's also this, from "Jabba the Nut" on the Adobe User to User forums, which is quite similar to the approach outlined in the Brookhouse document above:

I have used the following VB code to print an Excel range to an Adobe Acrobat .PDF file. The steps to accomplish this are as follows:

1. Print the range to a postscript file using Acrobat Distiller
2. Convert postscript file to .PDF using Acrobat Distiller API.

Make sure that you uncheck the "Do not send fonts to Distiller" option in the Distiller properties. You do this by entering the Distiller properties>>General Tab>>Printing Preferences>>Adobe PDF Settings and uncheck the "Do not send fonts to Distiller" option. You will get an error if you don't do this.

In the Excel Visual Basic Editor, make sure you include a reference to Acrobat Distiller.

Here is the code....

Private Sub CommandButton1_Click()

' Define the postscript and .pdf file names.
Dim PSFileName as String
Dim PDFFileName as String
PSFileName = "c:\myPostScript.ps"
PDFFileName = "c:\myPDF.pdf"

' Print the Excel range to the postscript file
Dim MySheet As WorkSheet
Set MySheet = ActiveSheet
MySheet.Range("myRange").PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, prtofilename:=PSFileName

' Convert the postscript file to .pdf
Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

End Sub


Content authoring & site maintenance by

Friday - The Automatic FAQ Maker