Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2010

    Question Unanswered: Add date to filename?

    I am using a macro to automatically output query results to Excel and I want to add the current date to the filename.

    Example: "Query Results - 01-MAR-2010.xlsx" (or something similar to that)

    It should be an easy thing, but I have tried multiple different things with no luck.


  2. #2
    Join Date
    Feb 2004
    One Flump in One Place

    Check the code bank - it includes some code written by moi to output to Excel - I am pretty sure it appends the date to the name.
    Point #1: You want to do anything remotely fancy then drop the macros - you need VBA
    Point #2: write out your dates yyyy-mm-dd: it will mean that when sorted alpha they will also be sorted chronologically.
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Dec 2004
    Madison, WI
    Here's the example in the code bank:

    The ExportForm allows you to export as an xls, csv, or dbf. You can also attach the date (or not) in the export filename (ie. ExportMyQueryName02-22-2010.xls). Look at the code behind the form to export the date in the filename as a different format. A Macro may not help you with exporting the filename with a date embedded in the filename.
    Last edited by pkstormy; 02-24-10 at 22:14.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Tags for this Thread

Posting Permissions

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