Results 1 to 4 of 4
  1. #1
    tdoyle is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    2

    ExportWithFormatting Macro to Save as PDF with a unique file name

    I am new to Access and I am generating forms that I would like to save as a PDF with a unique name such as 'March'_Report.PDF , 'April'_Report.PDF



    Is it possible to do this using a macro or is VBA needed?

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I don't use macros, but it may be possible. With VBA it would be simple to output with a given name. You'd use OutputTo and concatenate the fixed part(s) of the name with the variable part(s).

    My main point for chiming in is that most of us would suggest printing/outputting a report, not a form. You have more control over formatting and such.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tdoyle is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    2
    Would you be able to give me an example?

    I apologize I may be getting my terminology confused. I am running a Report through the Form. Thank you very much for responding!

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Here's one from an app I'm working on:

    strMaster = "\\PathHere" & Me.txtDriverNum & "_" & Format(Me.txtDORDate, "yyyymmdd") & "_Master.pdf"
    DoCmd.OutputTo acOutputReport, "rptMasterLeaseAgreement_Sig", acFormatPDF, strMaster

    which would create a file like

    \\ServerName\FolderName\12345_20190302_master.pdf

    which was the format the boss wanted. strMaster is a variable declared as String.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 07-30-2015, 05:52 AM
  2. ExportWithFormatting using Excel 2007?!
    By accessmatt in forum Macros
    Replies: 9
    Last Post: 11-06-2014, 10:00 AM
  3. ExportWithFormatting Error
    By voro in forum Import/Export Data
    Replies: 3
    Last Post: 10-29-2012, 09:29 AM
  4. Replies: 8
    Last Post: 03-16-2012, 01:07 PM
  5. How do you export a file with a unique file name
    By Budman42 in forum Import/Export Data
    Replies: 1
    Last Post: 10-15-2006, 06:10 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