Transfertext with date in file name.

B

Brian Layden

I'm trying to transfer a query in a macro to a text file. I would like the
file name to include the current date (i.e. File_Name_mmddyyyy). How can I
do this in my macro?
 
S

Steve Schapel

Brian,

In the File Name argument of the TransferText action in your macro, put
the equivalent of...
="C:\YourFolder\FileName_" & Format(Date(),"mmddyyyy") & ".txt"
 
J

jim

I tried this outputting to excel and I get the following error, any
suggestions?

-The file may be open. If so close...
-If you are using a template, check to make sure the template exits.
-If the file isn't open, check to to make sure that you have enough free
disk space.
-Make sure that the file exists on the path specified.

The file is not open, there is no template being used, free space??? the
file is not that large, 1000k when I run it without the date stamp.

I am outputting to the following location in excel format:

"c:\temp\All Piece Parts" & Format(Date(),"mmddyy") & ".xls"
 
K

Ken Snell [MVP]

Did you include the = sign at the beginning of your expression? Do just as
Steve posted.
 

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