View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chrissy[_4_] Chrissy[_4_] is offline
external usenet poster
 
Posts: 101
Default Excell macro Date help

I would suggest you use

ActiveWorkbook.SaveAs "c:\mypath\" & Format(Date,"yyyymmdd") & ".xls"

so that if you sort the files created they are sorted in data order with
all the files for this year sorted before any files for next year - and all
files for Jan this year are sorted before the ones for Feb. Your way
with mmddyy will sort all files from Jan in any year before any files
for any other month.

Chrissy/



"John Green" wrote in message ...
ActiveWorkbook.SaveAs "c:\mypath\" & Format(Date,"mmddyyyy") & ".xls"


--

John Green - Excel MVP
Sydney
Australia


"Tim_S" wrote in message ...
I made a macro to perform a "save as" and give it a file name as you see
below. I now need it to create the file name based on the date ...

ActiveWorkbook.SaveAs "c:\mypath\currentdump.xls"

I need it to save the file as the followint format.. (replace the mmddyyyy
with the date...)

ActiveWorkbook.SaveAs "c:\mypath\mmddyyyy.xls"

What do I need to do to accomplish this?

Thanks