automatically export and name

J

joemeshuggah

is there a way to automatically export information from access to excel and
include a date time stamp in the name?

currently i import an excel spreadsheet into access and then run 5 separate
queries to do all of the sorting and filtering, exporting the results of each
query to excel. i then change the title of each excel file to include the
current date.

i know i can create a macro to have all 5 queries run with the click of a
button, but i have no idea how to get all of them to also export to excel all
at once (preferably with a date time stamp in the name of the excel files).

anyone know how this could be accomplished (or if it is even possible)?
 
J

joemeshuggah

actually, let me clarify further....

im looking to simultaneously export 5 queries to excel where a date stamp is
used in each of the file names they are saved under AND have a macro run that
will format the excel spreadsheets.

probably not possible...but worth checking into.
 
J

Jeanette Cunningham

Hi,
I am not very familiar with macros, I use VBA to do this.

Here is the answer to the first part of exporting with the date as part of
the file name.

Here is code I use to add the date to an export.
The public function lives in a class module

Public Function CurrDate() As String

CurrDate = Format(Date, "dd-mm-yyyy")

End Function

Here is code I use to add the current date when I am exporting to excel
strFileNameEnd = CurrDate & ".xls"

I build the file name in code then add strFileNameEnd to the nearly complete
file name.

If you already have a file name,
you would need to add the CurrDate between the end of the file name but
before the extension.

To export the files at once, you would need to create a loop to export them
after you have the correct name for each file.
I am not very familiar with macros, I use VBA to do this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top