Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving with date in filename
I have this code:
ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\Ben Allen\My Documents\Eurotours\Eurotours.xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False Is there a wat to make it say the current month and year after the Eurotours bit in the name? Thanks -- Cheers, Ben Remove your.tonsils to reply "You only live once but if you do it right once is enough!" |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving with date in filename
Ben,
I got the solution from Bob Philips in one of the thread. Here is m code which save the current active sheet into a workbook with curren sheet name and date. So for your case, you need to include & Format(Date, "ddmmmyy") afte your file name and change it mmmyy. Sub FromSheetoWorkbook() ' ' Create individual workbook from active sheet ' Dim Fname, strMessage As String 'Save active sheet as a workbook with today's date Fname = ActiveSheet.Name & "-" & Format(Date, "ddmmmyy") ActiveSheet.Copy ActiveWorkbook.SaveAs Filename:=Fname & ".xls" ActiveWorkbook.Close SaveChanges:=False ' Display saved message strMessage = Fname & " saved in " & vbCrLf & vbCrLf & CurDir MsgBox strMessage, vbInformation, "File Saved!" ' End Su -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving with date in filename
Hi Ben,
I thought we had already done this one last week? Anyway sFilename = "C:\Documents and Settings\Ben Allen\" & _ "My Documents\Eurotours\Eurotours" & _ Format(Date,"yyyy mm") & ".xls", ActiveWorkbook.SaveAs Filename:= sFil;ename, _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Ben Allen" wrote in message ... I have this code: ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\Ben Allen\My Documents\Eurotours\Eurotours.xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False Is there a wat to make it say the current month and year after the Eurotours bit in the name? Thanks -- Cheers, Ben Remove your.tonsils to reply "You only live once but if you do it right once is enough!" |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Saving with date in filename
Something like this :-
MyDate = Format(Date, "dd-mm-yy") ' NB. cannot use slashes FileName = "C:\Documents and Settings\Ben Allen\My Documents\Eurotours\ " _ & "Eurotours" & " " & MyDate & ".xls" Regards BrianB *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving file using value in cell as the filename | Excel Worksheet Functions | |||
Saving XLS workbook with set filename | Excel Discussion (Misc queries) | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
Saving filename same as import filename | Excel Programming | |||
Saving Cell value as filename | Excel Programming |