Autosaving files with different names

G

Guest

Hello. Quick question. I have created a macro do create a report for me. I want it to save the file to a specific drive (ie. \\pkcfp001\tlynch07\Sales Distribution Reports\). When the original file is created, the name is given as SalesBaseReport04112004.xls where the 04112004 represents the date for the data in the file. If possible, I would like it to take just the date portion and create a filename based on the date in 04.11.2004.xls or 04-11-2004.xls format. The filename will change on a daily basis with the date. Is it possible to make this happen?
 
P

papou

Hi Thomas
Assuming date is today's:
Dim NameOFile$
NameOFile = Format(Date, "mm-dd-yyyy")
ThisWorkbook.SaveAs NameOFile & ".xls"

Regards
Pascal

Thomas L said:
Hello. Quick question. I have created a macro do create a report for me.
I want it to save the file to a specific drive (ie.
\\pkcfp001\tlynch07\Sales Distribution Reports\). When the original file is
created, the name is given as SalesBaseReport04112004.xls where the 04112004
represents the date for the data in the file. If possible, I would like it
to take just the date portion and create a filename based on the date in
04.11.2004.xls or 04-11-2004.xls format. The filename will change on a
daily basis with the date. Is it possible to make this happen?
 
G

Guest

Ok, I understand that, the only thing that would be different, is that the Date in the file is going to be behind 1 day (ie. File SalesBaseReport04112004.xls contains data from 4/11/04 but I wont receive it until 4/12/04 and want to save it as the data date, 4/11/04).
 

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