Print to acrobat writer

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Hi folks,

I have acrobat PDFwriter installed in my system. Is there
a way to print a report to pdf file and save the name to
c:\temp\test.pdf via module?

Thanks in advance.

Tim.
 
From my prior post:

Brian,

There are two ways that I have used to accomplish what you want: (1) use
send keys, it is kludge and may have problems if the user is pressing some
keys during the code execution, but it works or (2) add a value to the
registry for the PDF writer called "PDFFilename" doing so will suppress the
save as dialog box. Both instances are predicated on the default printer
being set to the PDFWriter.

Regards,
Dan
 
Dan,

Could you show the send key method? I changed the default
printer to Acrobat PDFwriter and print the report. Then,
I got “Save PDF File As” screen ask for the file name.
Could you show me how to pass “c:\temp\test.pdf” to
the “file name” field and press “OK” button.

Thanks a lot.

Tim.
 
Tim,

Here is an example that works from Excel:

Sub PrintFilePDF()

ChDrive Range("Drive").Value
ChDir Range("Folder").Value
Application.ActivePrinter = "Acrobat PDFWriter on LPT1:"
TestName = Range("FileName").ValueI view.
SendKeys (TestName) ' enters the name in the printout filename-box
SendKeys ("{ENTER}") ' presses the Enter button for me. I'm lazy!
ActiveWindow.SelectedSheets.PrintOut Copies:=1
MsgBox " File saved on disc was named " & TestName & ".pdf "

End Sub
 
Dan,

I ran the following code but it gave me the popup
screen “Save PDF File AS…….”.

Public Function test()

DoCmd.OpenReport "Table1", acViewNormal
SendKeys "{Enter}"

End Function

Could you tell me the way to continue the next line
instead of waiting for my respone?

Thanks a lot.

Tim.
 
Tim:

Using Send keys is a total waste and it unpredictable in success.

If you want an easy way to automate outputting PDF files using PDF writer or
any other Acrobat driver (any many others) take a look at our PDF and Mail
Library for Access. Solving your problem would involve code as simple as:

Dim objPDF as New PDFClass
With objPDF
.ReportName = "My Report"
.OutputFile = "c:\some dir\some file.pdf"
.ReportWhere = "Some SQL filter if desired"
.PrintImage
End With

You'll find the library on our web.
 
Back
Top