Printing PDFs from Access

C

Chris

Hi All

I'm having a problem printing PDFs from Access. I've tried using the Adobe
object (SDK) to print them but that doesn't always work.
Instead I tried using the shell command - this works every time but it makes
the Adobe application visible and leaves it open which is a real problem.
Does anyone know how to do this invisibly and close the application
afterwards.

The code I'm using is below.

Cheers
Chris

strFileNameToPrint = gconstr_REPORTS_FILE_PATH_LOCAL & strFileNameToPrint &
".pdf"
strPrinterName = Printer.DeviceName
strDriverName = Printer.DriverName
strPortName = Printer.Port

strCommandLine = "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe /t
""" + _
strFileNameToPrint + """ """ + _
strPrinterName + """ """ + _
strDriverName + """ """ + _
strPortName + """"

If Not (Shell(strCommandLine, 0) <> 0) Then
rstrError = "There is a problem printing the PDF file : " _
& vbCrLf & vbCrLf & strFileNameToPrint

GoTo printReportPackages_Exit
End If
 
L

Leonard Selmani

I think there's two things you could try:

one, create a batch file and run it from access, and leave
the printing of the pdf to the batch file. I think there's
a switch that can specify if you want the app minimized
and then closed once it is done

two, try DDE. It will take a little if you are new to it,
but it might work
http://www.angelfire.com/biz/rhaminisys/ddeinfo.html#DDEtop
 
C

Carter harvey

No need to go through VB hoops.. I print hundreds of
reports quarterly through Acrobat Distiller (comes with
Adobe Acrobat, but there are other 3rd party utilities for
cheaper). Install it as a Printer, and you can either set
it as your default printer, or specify in the Report Page
Setup properties to specifically print to the Distiller..

Set the path for where you want the pdf to print to in the
Distiller, and voila! Insta-PDF's! You can even set it to
not ask for filename, overwrite, and not open Acrobat
after each pdf for batch printing.

Enjoy!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top