This code will definetly serve your purpose. Use

Location = "E:\abdc"

Filename = "MyFile_Backup_" & Format(Now(),"YY-MM-DD HH:MM:SS") &
".xls"


Thisworkbook.SaveCopyAs (Location & Filename)

Please note that I have not use "SaveAs "
You can this code and see what is the difference between these two






On Sep 15, 10:02 pm, Paul Schreiner <schreiner_p...@att.net> wrote:
> First of all, Excel already has an AutoRecover feature
> that saves the file every X minutes to a separate location...
>
> but I don't like it either.
>
> What do you mean by "automatically"?
>
> for instance,  I have a "save event" that
> does a "SaveCopyAs"
>
> like:
>
> Option Explicit
> Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
>     Dim ThisDay, CurTime, fso, BackupFolder, BackupName
>     If (ActiveWorkbook.Name = "TGOR Project Summary_Master.xls") Then
>         Cancel = True
>         Set fso = CreateObject("Scripting.FileSystemObject")
>         ThisDay = Format(Now, "yyyy-mm-dd")
>         CurTime = Format(Now, "hh")
>         BackupFolder = "C:\temp\"
>         BackupName = "TGOR Project Summary_Master_" & ThisDay & "_" & CurTime 
> & ".xlsm"
>         If (Not fso.fileexists(BackupFolder & BackupName)) Then
>             Application.EnableEvents = False
>             Application.StatusBar = "Saving Backup File"
>             Application.DisplayAlerts = False
>             ActiveWorkbook.SaveCopyAs Filename:=BackupFolder & BackupName
>             Application.StatusBar = False
>             ActiveWorkbook.Save
>             Application.EnableEvents = True
>             Application.DisplayAlerts = True
>         End If
>     End If
>             Application.StatusBar = False
> End Sub
>
> with this event, whenever I hit the SAVE button, it creates a backup of the 
> file before it is saved.
> But only once an hour.
> Otherwise, I'd have hundreds of files!
>
> is this the kind of thing you're looking for? or something more automated?
>
> ________________________________
> From: ashish koul <koul.ash...@gmail.com>
> To: excel-macros@googlegroups.com
> Sent: Tuesday, September 15, 2009 12:07:40 PM
> Subject: $$Excel-Macros$$ hi all backup code
>
> hi
>
> i need a code which will automatically create a backup of my file at the 
> location i specify to it
>
> thanks

--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to