Including date in output file name

  • Thread starter Thread starter VS
  • Start date Start date
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!
 
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
 
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
 
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
 
Back
Top