You can WRITE macro for this.

Fairly simple.

There are LOTS of questions though, in order to make it fit your situation.

Q: Are you wanting to save a COPY of the existing file?
as in: 
open a template file, 
read data, 
perform calculations, 
do stuff, 
save a copy with current data with today's date.
Exit template without saving

Q: Do you want to save the file and have it be the OPEN workbook?
When you manually do a "Save As.." it saves the current workbook using the 
specified options. The current workbook then has the new name.
But, with vba, you have the option of saving the current workbook as a COPY, 
but 
leave the current workbook open.
That is: 
Open Template file
Do stuff
Save current file as new file.
Template file is still open, and NOT saved.

Q: Where do you want to put the file?
You can "assume" the new file goes where the current file is located,
or you can specify a new location within the macro,
or you can have the macro prompt for a new location.

Q: What format do you want the date in the file name to be?
Of course, you're limited to valid file name characters.
You cannot use:  FileName_01/25/2013.xlsb because the "/" characters are not 
legal.

Q: What do you want to do if the file already exists?
Do you want to overwrite it? 
or prompt to overwrite?
or create a second version?


decisions, decisions....

The simplest version would be something like:
'------------------------------------------------------
    sPath = ThisWorkbook.Path
    If (Right(sPath, 1) <> "\") Then sPath = sPath & "\"
    
    sDate = Format(Now(), "yyyy-mm-dd")
    
    NewFile = Replace(ThisWorkbook.Name, ".xlsb", "") & "_" & sDate & ".xlsb"
    
    ActiveWorkbook.SaveAs Filename:=sPath & NewFile
'------------------------------------------------------
This assumes you want to save it back to the same directory as the file with 
this macro.
It also makes this new file the "active" one.


Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: suresh k <brave.sur...@gmail.com>
To: Excel group <excel-macros@googlegroups.com>
Sent: Fri, January 25, 2013 7:15:19 AM
Subject: $$Excel-Macros$$ Save excel with date

Hi,

I am trying to save excel file using macro.. The file name should be
my name followed by today's date.

Is there any macro for this?

/Suresh

-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.

-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.


Reply via email to