Results 1 to 2 of 2
  1. #1
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317

    Printing a report to PDF through VBA – finishing touches

    Hi Folks



    I've added a button to my switchboard that I want to use to print a report to PDF automatically. The following code takes me as far as the 'Save PDF File As' dialogue box:
    Code:
     
        Dim stDocName As String
        stDocName = "MyReport"
        Set Application.Printer = Application.Printers("Adobe PDF")
        DoCmd.OpenReport stDocName, acNormal
        Set Application.Printer = Nothing
    Can anyone tell me how to accomplish the following?
    1. Automatically insert the file name (it will always be 'Work Overview').
    2. Simulate hitting 'Save'.
    3. Simulate answering 'Yes' when asked if I want to overwrite the existing PDF file of that name.
    4. Prevent the new PDF file from opening automatically.
    Any suggestions would be appreciated.

    Thanks

    Remster

    PS I'm aware of 'Stephen Lebans's ReportToPDF' offering, but I can't download zip files.

  2. #2
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317
    Well, 1 turns out to be straightforward enough: I simply made 'Work Overview' the report's caption, and it was passed automatically to the dialogue box ...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Report printing
    By Andrevw in forum Reports
    Replies: 1
    Last Post: 01-16-2011, 06:08 PM
  2. Printing Blank Report
    By andrewm in forum Reports
    Replies: 2
    Last Post: 11-24-2010, 05:30 PM
  3. Problem when printing report
    By bosve73 in forum Reports
    Replies: 13
    Last Post: 08-31-2010, 11:24 PM
  4. Custom Report Printing
    By robocopfl in forum Reports
    Replies: 3
    Last Post: 06-04-2010, 12:23 PM
  5. Report Printing
    By newtoAccess in forum Reports
    Replies: 5
    Last Post: 12-02-2009, 07:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums