Save As "something" then date

  • Thread starter Thread starter andywalker
  • Start date Start date
A

andywalker

Hi,

I'm looking for a way automatically save an excel sheet with a date i
the filename for easy identification. id like it to follow the forma
below

dd-mm-yy Stats.xls

the code i have is:

Sub SaveDate()



ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Andrew\Desktop\" & Format(Date, dd
mm - yy) & "Stats"

End Sub

The problem i have is that it saves as the number which excel generate
for dates so if it was the 1/1/1900 it would save as 00001 stats.xls

obviously i cant have the date as 1/1/1900 stats.xls as windows wouldn
accept it

any ideas?

thanks in advanc
 
Hi Andy,

Try:

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Andrew\Desktop\" & _
Format(Date, "dd - mm - yy") & " Stats"

Note the quotation marks and the space before Stats.
 
You might as well also use the date for sorting

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Andrew\Desktop\" & Format(Date, "yyyy-mm-dd") &
"Stats"

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Back
Top