save a file with current date inserted automatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to create macro in spreadsheet that will save the file to a specified
location using a specified name followed by the current date. Catch is I
want the current date to be inserted automatically. How is this done? may
not be able to access at work so if not a prob. post answer to
(e-mail address removed) thanx in advance
 
Try this:

ActiveWorkbook.SaveAs FileName:= _
ActiveWorkbook.Name & "_" & DatePart("yyyy", Date) & DatePart("m", Date) &
DatePart("d", Date)

Then depending on whether you want to save as .csv or .xls, etc. you can add

FileFormat:=xlNormal
or
FileFormat:=xlCSV

and other options. You'll have to play with whether or not you need to add
the extension (like & ".xls" after the DatePart.

HTH
 

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

Similar Threads


Back
Top