Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2011
    Posts
    48

    Unanswered: Exporting to excel with date using output to in output macro

    I am sure this is easy, I just can't seem to find it. I have an export macro, and I want it to export with a date, so the file doesn't get over written every time. Is there an easy to do this? Like just adding something to the path?

  2. #2
    Join Date
    Oct 2011
    Posts
    16
    Relatively easy.

    You can't just write:
    "c:\Junk\File " & Format(Now(),"Short Date") & ".xlsx"


    Because short dates use slashes that foul the directory path.

    Assuming it's a monthly report, you can try to set-up a variable first:

    D=Year(Now()) & Month(Now())

    Then the code looks like this:

    "c:\Junk\File " & D & ".xlsx"

    And results in a file named: "File 201110.xlsx"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •