Save file as todays date

R

Rinto Syah

I made a macro on the excel and at the end of the macro I save it on a new
file. Can I put the date when I save the file as part of the file name?

Here is copy the last part of the macro:

ActiveWorkbook.SaveAs Filename:= _
"O:\Shared Services\Finance\2009\IC\IC
Detail\IST_3_1_Update_ddmmyyyy.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
 
P

Per Jessen

Hi

Try this:

MyDate = Format(Date, "ddmmyyyy")
ActiveWorkbook.SaveAs Filename:= _
"O:\Shared Services\Finance\2009\IC\IC Detail\IST_3_1_Update_" &
MyDate & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Regards,
Per
 
S

Simon Lloyd

Like this
Code:
--------------------

ActiveWorkbook.SaveAs Filename:= _
"O:\Shared Services\Finance\2009\IC\IC
Detail\IST_3_1_Update_" & Format(date,"ddmmyyyy") & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

--------------------

I made a macro on the excel and at the end of the macro I save it on a
new
file. Can I put the date when I save the file as part of the file name?

Here is copy the last part of the macro:

ActiveWorkbook.SaveAs Filename:= _
"O:\Shared Services\Finance\2009\IC\IC
Detail\IST_3_1_Update_ddmmyyyy.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
 
J

Jacob Skaria

Use Format(Date,) as below.......Please modify the path...

strFileName = "c:\Update_" & Format(Date, "ddmmyyyy") & ".xls"
ActiveWorkbook.SaveAs Filename:=strFileName, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
 
R

Rinto Syah

Wow, this helps. Thanks Jacob...

Jacob Skaria said:
Use Format(Date,) as below.......Please modify the path...

strFileName = "c:\Update_" & Format(Date, "ddmmyyyy") & ".xls"
ActiveWorkbook.SaveAs Filename:=strFileName, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
 

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