View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
sp00nix[_11_] sp00nix[_11_] is offline
external usenet poster
 
Posts: 1
Default AutoSave a WB copy everynight at midnight

And that's exactly what I did.. Here's the code for anyone who woul
like to reference this thread in the futu


Code
-------------------

Dim fso
Dim myDate
if len(month(date())) = 2 then
myDate = Replace(FormatDateTime(Date(),2),"/","-")
else
myDate = "0" & Replace(FormatDateTime(Date(),2),"/","-") & " "
end if
set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "myFile.xls", _
"c:\backup\myFile" _
& myDate _
& Replace(FormatDateTime(Time(),4),":",".") & ".xls"
set fso = nothing
'msgbox "Done!"

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


This will save a copy similar to "myFile 07-28-2004 23.55.xls" in you
back up directory. In this case, i scheduled it daily, at 11:55 PM

--
Message posted from http://www.ExcelForum.com