Including date in output file name

V

VS

Hi,

I have a macro that executes a query, then exports the
data into Excel using "OutputTo" action.

What I need is to have today's date included in the file
name but I have no idea how to do so.

I have set windows scheduler to run this macro daily and
I don't want to overide previously exported files. Any
suggestions?

Thanks!
 
S

Steve Schapel

VS,

I am not sure what "executes a query" means in this context, but on
the face of it, there would be no need to do anything other than the
OutputTo action in your macro. In response to your specific question,
put the equivalent of the following in the Output File argument of the
macro...
="C:\YourFolder\bla_" & Format(Date(),"ddmmyy") & ".xls"

- Steve Schapel, Microsoft Access MVP
 
V

VS

Hi Steve,

Thanks for taking time to answer my question.

I've tried what you suggested, but what happened was, the
macro decided use to what I put in the argument as it
is..that is to name the file literally as
<"C:\YourFolder\bla_" & Format(Date(),"ddmmyy") & ".xls">

Because of the special characters, the file could not be
exported out. I would really appreciate if you can advise
me again...

Thanks and Regards,
-----Original Message-----
VS,

I am not sure what "executes a query" means in this context, but on
the face of it, there would be no need to do anything other than the
OutputTo action in your macro. In response to your specific question,
put the equivalent of the following in the Output File argument of the
macro...
="C:\YourFolder\bla_" & Format(Date(),"ddmmyy") & ".xls"

- Steve Schapel, Microsoft Access MVP
 
V

VS

Hi Steve,

You are absolutely right! Pretty dumb of me... =) Thanks
for all your help...

Cheers,
-----Original Message-----
VS,

I think you forgot the = in the front of the expression in the macro
argument. Please post back if this is not thte problem, and we'll
think again!

- Steve Schapel, Microsoft Access MVP
 

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