How to Append Date to a .pdf export using macros?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • metronj
    New Member
    • Sep 2013
    • 14

    How to Append Date to a .pdf export using macros?

    Hi again :)

    I saw some examples of this being done with excel exports and tried modifying them for .pdf use but I can't seem to get it to work.

    I have a macro which is converting some reports to .pdf and I want to append today's date to them since the reports will be stored for historical reference.

    Here is the code I have, which I found by searching similar topics around the web, including here :) This is being done on the "Output File" line of the exportwithforma tting function in the macro generator:

    Code:
    "C:\Users\someuser\Desktop\Paper Inventory Report" & Format(Date(),"yymmdd") & ".pdf"
    The report comes out but it stops at "Paper Inventory Report" and never appends the date or file extension. Can someone please help me out with this? Is it a syntax problem? I've seen people say this has to be done in VBA and not macro's but I don't have any idea how to make it work in VBA.

    Thanks in advance for any and all help.
  • metronj
    New Member
    • Sep 2013
    • 14

    #2
    I figured it out, turns out you HAVE to have the "equal" sign in front of the whole thing:

    Code:
    ="C:\Users\someuser\Desktop\Availability Report_" & Format(Date(),"yyyy-mm-dd") & ".pdf"
    Hope this helps someone someday..

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #3
      I'm glad you got this to work; however, your original question left out some details...
      Which version of Access?
      What Macro actions you were/are using?
      Etc..
      If you would provide those details, the solution would be that much more usefull for those having the same issue.

      Comment

      • metronj
        New Member
        • Sep 2013
        • 14

        #4
        Ahh.

        This is Access 2010 and using the "exportwithform atting" option in the list.

        Sorry about that.
        Last edited by zmbd; Oct 4 '13, 01:31 PM. Reason: [z{No Edit: thank you for following up (^-^) }]

        Comment

        Working...