Automatically saving an Excel spreadsheet with today's date in the filename

I

Ian M

Firstly, thank you CHRIS for solving my problem relating to disabling
macros - I tried to reply to you but my password is not recognised.

I now wish to save a file with today's date automatically in the
filename, for example:

"Accounts figures 28 April 2004.xls"

Can the date be inserted automatically?

Any ideas?

Thank you.

Kind regards,

Ian M
 
C

chris

Put this code in your Workbook BeforeClose Event found in ThisWorkbook of your project windo

Private Sub Workbook_BeforeClose(Cancel As Boolean
If InStr(ActiveWorkbook.Name, CStr(Format(Now, "dd mmmm yyyy"))) = 0 The
ActiveWorkbook.SaveAs Filename:=
"Accounts figures" & " " & CStr(Format(Now, "dd mmmm yyyy")
End I
End Su

----- Ian M wrote: ----

Firstly, thank you CHRIS for solving my problem relating to disablin
macros - I tried to reply to you but my password is not recognised

I now wish to save a file with today's date automatically in th
filename, for example

"Accounts figures 28 April 2004.xls

Can the date be inserted automatically

Any ideas

Thank you

Kind regards

Ian
 
Top