View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
slc[_12_] slc[_12_] is offline
external usenet poster
 
Posts: 1
Default 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