PC Review


Reply
Thread Tools Rate Thread

How to backup excel files?

 
 
=?Utf-8?B?cm9tZWxzYg==?=
Guest
Posts: n/a
 
      2nd Nov 2006
Can anybody of good intention, program an excel workbook to provide another
back up file...I had many experience since 1992 wherein after saving and
closing my files and re-open again,,,error will appear and then it is unable
to read....I loss bunch of time using the good functions of excel yet the
program cannot fully protect the users work...I am still hoping that good
VBE tricks may do this ...proofcheck>save>backup>close....
--
"Bright minds are blessed to those who share them.."-rsb.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?RFM=?=
Guest
Posts: n/a
 
      2nd Nov 2006
Hi romelsb,

I take it setting the "backup" option in the SaveAs dialog box to
automatically back up your workbook isn't sufficient?

If you use the following, it'll automatically save your workbook in the
current location, and back up your workbook to the specified location on
close. This needs placing in the ThisWorkbook section, rather than in a
module or sheet.

****************
Private Sub Workbook_BeforeClose(Cancel As Boolean)

ThisWorkbook.Save
ThisWorkbook.SaveAs "C:\BackUps\NameIt.xls", Password:="yahoo"

End Sub
****************
You'll obviously need to direct the path above to a valid folder, file name
etc!

WARNING: this will save the workbook on close. If you may want to close
WITHOUT saving, add a yes/no message box to the beginning of the code to
allow the user to exit without saving / backing up. Very useful when you're
doing some development and you make a complete hash of things and just want
to start again from your last save point... as I found out the hard way!!!

HTH
DS





"romelsb" wrote:

> Can anybody of good intention, program an excel workbook to provide another
> back up file...I had many experience since 1992 wherein after saving and
> closing my files and re-open again,,,error will appear and then it is unable
> to read....I loss bunch of time using the good functions of excel yet the
> program cannot fully protect the users work...I am still hoping that good
> VBE tricks may do this ...proofcheck>save>backup>close....
> --
> "Bright minds are blessed to those who share them.."-rsb.

 
Reply With Quote
 
=?Utf-8?B?cm9tZWxzYg==?=
Guest
Posts: n/a
 
      2nd Nov 2006
tHANKS FOR THE QUICKEST REPLY....your good...let me give specifics...I NEED A
BACKUP UP OF AT LEAST 2 file of the latest update......If i use today the
orig. file, save/close then i will have a backup file on a specified
folder....After one month, if i open>make changes>save>close the same orig.
file then i will have another backup auto filename(lets say with text date)
on the same specified folder...In this stage I have a history
back-ups....Will you help me with this because I need the orig file be used
like a template and at the same time with updated development (i.e. formula,
data, new sheets)....again thanks...more power...pls reply....
--
"Bright minds are blessed to those who share them.."-rsb.


"DS" wrote:

> Hi romelsb,
>
> I take it setting the "backup" option in the SaveAs dialog box to
> automatically back up your workbook isn't sufficient?
>
> If you use the following, it'll automatically save your workbook in the
> current location, and back up your workbook to the specified location on
> close. This needs placing in the ThisWorkbook section, rather than in a
> module or sheet.
>
> ****************
> Private Sub Workbook_BeforeClose(Cancel As Boolean)
>
> ThisWorkbook.Save
> ThisWorkbook.SaveAs "C:\BackUps\NameIt.xls", Password:="yahoo"
>
> End Sub
> ****************
> You'll obviously need to direct the path above to a valid folder, file name
> etc!
>
> WARNING: this will save the workbook on close. If you may want to close
> WITHOUT saving, add a yes/no message box to the beginning of the code to
> allow the user to exit without saving / backing up. Very useful when you're
> doing some development and you make a complete hash of things and just want
> to start again from your last save point... as I found out the hard way!!!
>
> HTH
> DS
>
>
>
>
>
> "romelsb" wrote:
>
> > Can anybody of good intention, program an excel workbook to provide another
> > back up file...I had many experience since 1992 wherein after saving and
> > closing my files and re-open again,,,error will appear and then it is unable
> > to read....I loss bunch of time using the good functions of excel yet the
> > program cannot fully protect the users work...I am still hoping that good
> > VBE tricks may do this ...proofcheck>save>backup>close....
> > --
> > "Bright minds are blessed to those who share them.."-rsb.

 
Reply With Quote
 
=?Utf-8?B?RFM=?=
Guest
Posts: n/a
 
      2nd Nov 2006
OK, that gives us a better idea!


If you use:

**************
Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim Confirm

Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
"Confirm Backup?")
If Confirm = vbNo Then
Exit Sub
End If

ThisWorkbook.Save

ThisWorkbook.SaveAs "H:\crawsm\MyDocuments\NewName" & Format(Date,
"yyyymmdd") & ".xls"

End Sub
**************

This will save the current copy in its location, and save a backup to the
fodler / file specified with the current date in format yyyymmdd added to the
file name.

It also adds a confirmation request as I mentioned earlier to make sure that
you actually want to save and backup before it does! Just take that out if
it's not suitable for your needs.

HTH
DS


"romelsb" wrote:

> tHANKS FOR THE QUICKEST REPLY....your good...let me give specifics...I NEED A
> BACKUP UP OF AT LEAST 2 file of the latest update......If i use today the
> orig. file, save/close then i will have a backup file on a specified
> folder....After one month, if i open>make changes>save>close the same orig.
> file then i will have another backup auto filename(lets say with text date)
> on the same specified folder...In this stage I have a history
> back-ups....Will you help me with this because I need the orig file be used
> like a template and at the same time with updated development (i.e. formula,
> data, new sheets)....again thanks...more power...pls reply....
> --
> "Bright minds are blessed to those who share them.."-rsb.
>
>
> "DS" wrote:
>
> > Hi romelsb,
> >
> > I take it setting the "backup" option in the SaveAs dialog box to
> > automatically back up your workbook isn't sufficient?
> >
> > If you use the following, it'll automatically save your workbook in the
> > current location, and back up your workbook to the specified location on
> > close. This needs placing in the ThisWorkbook section, rather than in a
> > module or sheet.
> >
> > ****************
> > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> >
> > ThisWorkbook.Save
> > ThisWorkbook.SaveAs "C:\BackUps\NameIt.xls", Password:="yahoo"
> >
> > End Sub
> > ****************
> > You'll obviously need to direct the path above to a valid folder, file name
> > etc!
> >
> > WARNING: this will save the workbook on close. If you may want to close
> > WITHOUT saving, add a yes/no message box to the beginning of the code to
> > allow the user to exit without saving / backing up. Very useful when you're
> > doing some development and you make a complete hash of things and just want
> > to start again from your last save point... as I found out the hard way!!!
> >
> > HTH
> > DS
> >
> >
> >
> >
> >
> > "romelsb" wrote:
> >
> > > Can anybody of good intention, program an excel workbook to provide another
> > > back up file...I had many experience since 1992 wherein after saving and
> > > closing my files and re-open again,,,error will appear and then it is unable
> > > to read....I loss bunch of time using the good functions of excel yet the
> > > program cannot fully protect the users work...I am still hoping that good
> > > VBE tricks may do this ...proofcheck>save>backup>close....
> > > --
> > > "Bright minds are blessed to those who share them.."-rsb.

 
Reply With Quote
 
=?Utf-8?B?cm9tZWxzYg==?=
Guest
Posts: n/a
 
      2nd Nov 2006
ooopss...so good....sorry i dont know how to place it in VBE...can u tech me
just for this sake....I need the backup filename just like u
formatted.....will it be like this...
if filename of orig. workbook is "DEVELOPER.xls"
then
does the first backup will be this "DEVELOPER 2006NOV02.xls"
THANKS A LOT....pls reply back...

--
"Bright minds are blessed to those who share them.."-rsb.


"DS" wrote:

> OK, that gives us a better idea!
>
>
> If you use:
>
> **************
> Private Sub Workbook_BeforeClose(Cancel As Boolean)
>
> Dim Confirm
>
> Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> "Confirm Backup?")
> If Confirm = vbNo Then
> Exit Sub
> End If
>
> ThisWorkbook.Save
>
> ThisWorkbook.SaveAs "H:\crawsm\MyDocuments\NewName" & Format(Date,
> "yyyymmdd") & ".xls"
>
> End Sub
> **************
>
> This will save the current copy in its location, and save a backup to the
> fodler / file specified with the current date in format yyyymmdd added to the
> file name.
>
> It also adds a confirmation request as I mentioned earlier to make sure that
> you actually want to save and backup before it does! Just take that out if
> it's not suitable for your needs.
>
> HTH
> DS
>
>
> "romelsb" wrote:
>
> > tHANKS FOR THE QUICKEST REPLY....your good...let me give specifics...I NEED A
> > BACKUP UP OF AT LEAST 2 file of the latest update......If i use today the
> > orig. file, save/close then i will have a backup file on a specified
> > folder....After one month, if i open>make changes>save>close the same orig.
> > file then i will have another backup auto filename(lets say with text date)
> > on the same specified folder...In this stage I have a history
> > back-ups....Will you help me with this because I need the orig file be used
> > like a template and at the same time with updated development (i.e. formula,
> > data, new sheets)....again thanks...more power...pls reply....
> > --
> > "Bright minds are blessed to those who share them.."-rsb.
> >
> >
> > "DS" wrote:
> >
> > > Hi romelsb,
> > >
> > > I take it setting the "backup" option in the SaveAs dialog box to
> > > automatically back up your workbook isn't sufficient?
> > >
> > > If you use the following, it'll automatically save your workbook in the
> > > current location, and back up your workbook to the specified location on
> > > close. This needs placing in the ThisWorkbook section, rather than in a
> > > module or sheet.
> > >
> > > ****************
> > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > >
> > > ThisWorkbook.Save
> > > ThisWorkbook.SaveAs "C:\BackUps\NameIt.xls", Password:="yahoo"
> > >
> > > End Sub
> > > ****************
> > > You'll obviously need to direct the path above to a valid folder, file name
> > > etc!
> > >
> > > WARNING: this will save the workbook on close. If you may want to close
> > > WITHOUT saving, add a yes/no message box to the beginning of the code to
> > > allow the user to exit without saving / backing up. Very useful when you're
> > > doing some development and you make a complete hash of things and just want
> > > to start again from your last save point... as I found out the hard way!!!
> > >
> > > HTH
> > > DS
> > >
> > >
> > >
> > >
> > >
> > > "romelsb" wrote:
> > >
> > > > Can anybody of good intention, program an excel workbook to provide another
> > > > back up file...I had many experience since 1992 wherein after saving and
> > > > closing my files and re-open again,,,error will appear and then it is unable
> > > > to read....I loss bunch of time using the good functions of excel yet the
> > > > program cannot fully protect the users work...I am still hoping that good
> > > > VBE tricks may do this ...proofcheck>save>backup>close....
> > > > --
> > > > "Bright minds are blessed to those who share them.."-rsb.

 
Reply With Quote
 
=?Utf-8?B?RFM=?=
Guest
Posts: n/a
 
      2nd Nov 2006
Hi romelsb,

OK, here we go.

Open your Excel workbook, and along the top, click the following (each will
open after the other):

Tools -> Macro -> Visual Basic Editor

You should see a number of panes, split across the screen. On your left
should be a pane headed "Project - VBA Project", with a list of items below
it. One of these should be your item, something like "VBA Project
(DEVELOPER.xls)". Click on the plus symbol, and you should see some more
options underneath, including "Microsoft Excel Objects". Click the plus
symbol next to this, and you'll see a long list, of every sheet in the
workbook,as well as, at the bottom "ThisWorkbook".

Double-click "ThisWorkbook" and you'll get an editor pane open up in the
main body. Copy the following and paste it into that pane. Then close the
editor, and save the workbook.

*********************
Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim Confirm

Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
"Confirm Backup?")
If Confirm = vbNo Then
Exit Sub
End If

ThisWorkbook.Save
ThisWorkbook.SaveAs "C:\backups\Developer_" & Format(Date, "yyyymmdd") &
".xls"

End Sub
*********************

This will save the current version in place, and a copy to the folder
"C:\Backups" (which you'll need to create before first use), and the backup
copy will be named as "Developer_20061102.xls" (example as one done today, it
will update as per the date actioned).

Done and done.
HTH
DS


"romelsb" wrote:

> ooopss...so good....sorry i dont know how to place it in VBE...can u tech me
> just for this sake....I need the backup filename just like u
> formatted.....will it be like this...
> if filename of orig. workbook is "DEVELOPER.xls"
> then
> does the first backup will be this "DEVELOPER 2006NOV02.xls"
> THANKS A LOT....pls reply back...
>
> --
> "Bright minds are blessed to those who share them.."-rsb.
>
>
> "DS" wrote:
>
> > OK, that gives us a better idea!
> >
> >
> > If you use:
> >
> > **************
> > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> >
> > Dim Confirm
> >
> > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > "Confirm Backup?")
> > If Confirm = vbNo Then
> > Exit Sub
> > End If
> >
> > ThisWorkbook.Save
> >
> > ThisWorkbook.SaveAs "H:\crawsm\MyDocuments\NewName" & Format(Date,
> > "yyyymmdd") & ".xls"
> >
> > End Sub
> > **************
> >
> > This will save the current copy in its location, and save a backup to the
> > fodler / file specified with the current date in format yyyymmdd added to the
> > file name.
> >
> > It also adds a confirmation request as I mentioned earlier to make sure that
> > you actually want to save and backup before it does! Just take that out if
> > it's not suitable for your needs.
> >
> > HTH
> > DS
> >
> >
> > "romelsb" wrote:
> >
> > > tHANKS FOR THE QUICKEST REPLY....your good...let me give specifics...I NEED A
> > > BACKUP UP OF AT LEAST 2 file of the latest update......If i use today the
> > > orig. file, save/close then i will have a backup file on a specified
> > > folder....After one month, if i open>make changes>save>close the same orig.
> > > file then i will have another backup auto filename(lets say with text date)
> > > on the same specified folder...In this stage I have a history
> > > back-ups....Will you help me with this because I need the orig file be used
> > > like a template and at the same time with updated development (i.e. formula,
> > > data, new sheets)....again thanks...more power...pls reply....
> > > --
> > > "Bright minds are blessed to those who share them.."-rsb.
> > >
> > >
> > > "DS" wrote:
> > >
> > > > Hi romelsb,
> > > >
> > > > I take it setting the "backup" option in the SaveAs dialog box to
> > > > automatically back up your workbook isn't sufficient?
> > > >
> > > > If you use the following, it'll automatically save your workbook in the
> > > > current location, and back up your workbook to the specified location on
> > > > close. This needs placing in the ThisWorkbook section, rather than in a
> > > > module or sheet.
> > > >
> > > > ****************
> > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > >
> > > > ThisWorkbook.Save
> > > > ThisWorkbook.SaveAs "C:\BackUps\NameIt.xls", Password:="yahoo"
> > > >
> > > > End Sub
> > > > ****************
> > > > You'll obviously need to direct the path above to a valid folder, file name
> > > > etc!
> > > >
> > > > WARNING: this will save the workbook on close. If you may want to close
> > > > WITHOUT saving, add a yes/no message box to the beginning of the code to
> > > > allow the user to exit without saving / backing up. Very useful when you're
> > > > doing some development and you make a complete hash of things and just want
> > > > to start again from your last save point... as I found out the hard way!!!
> > > >
> > > > HTH
> > > > DS
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > "romelsb" wrote:
> > > >
> > > > > Can anybody of good intention, program an excel workbook to provide another
> > > > > back up file...I had many experience since 1992 wherein after saving and
> > > > > closing my files and re-open again,,,error will appear and then it is unable
> > > > > to read....I loss bunch of time using the good functions of excel yet the
> > > > > program cannot fully protect the users work...I am still hoping that good
> > > > > VBE tricks may do this ...proofcheck>save>backup>close....
> > > > > --
> > > > > "Bright minds are blessed to those who share them.."-rsb.

 
Reply With Quote
 
=?Utf-8?B?cm9tZWxzYg==?=
Guest
Posts: n/a
 
      2nd Nov 2006
thanks...i had tried...see this line
i do as instructed
upon closing
syntax error pop-up
vbe opened
then the ine below is highlighted

Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,

pls...continue to reply
--
"Bright minds are blessed to those who share them.."-rsb.


"DS" wrote:

> Hi romelsb,
>
> OK, here we go.
>
> Open your Excel workbook, and along the top, click the following (each will
> open after the other):
>
> Tools -> Macro -> Visual Basic Editor
>
> You should see a number of panes, split across the screen. On your left
> should be a pane headed "Project - VBA Project", with a list of items below
> it. One of these should be your item, something like "VBA Project
> (DEVELOPER.xls)". Click on the plus symbol, and you should see some more
> options underneath, including "Microsoft Excel Objects". Click the plus
> symbol next to this, and you'll see a long list, of every sheet in the
> workbook,as well as, at the bottom "ThisWorkbook".
>
> Double-click "ThisWorkbook" and you'll get an editor pane open up in the
> main body. Copy the following and paste it into that pane. Then close the
> editor, and save the workbook.
>
> *********************
> Private Sub Workbook_BeforeClose(Cancel As Boolean)
>
> Dim Confirm
>
> Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> "Confirm Backup?")
> If Confirm = vbNo Then
> Exit Sub
> End If
>
> ThisWorkbook.Save
> ThisWorkbook.SaveAs "C:\backups\Developer_" & Format(Date, "yyyymmdd") &
> ".xls"
>
> End Sub
> *********************
>
> This will save the current version in place, and a copy to the folder
> "C:\Backups" (which you'll need to create before first use), and the backup
> copy will be named as "Developer_20061102.xls" (example as one done today, it
> will update as per the date actioned).
>
> Done and done.
> HTH
> DS
>
>
> "romelsb" wrote:
>
> > ooopss...so good....sorry i dont know how to place it in VBE...can u tech me
> > just for this sake....I need the backup filename just like u
> > formatted.....will it be like this...
> > if filename of orig. workbook is "DEVELOPER.xls"
> > then
> > does the first backup will be this "DEVELOPER 2006NOV02.xls"
> > THANKS A LOT....pls reply back...
> >
> > --
> > "Bright minds are blessed to those who share them.."-rsb.
> >
> >
> > "DS" wrote:
> >
> > > OK, that gives us a better idea!
> > >
> > >
> > > If you use:
> > >
> > > **************
> > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > >
> > > Dim Confirm
> > >
> > > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > > "Confirm Backup?")
> > > If Confirm = vbNo Then
> > > Exit Sub
> > > End If
> > >
> > > ThisWorkbook.Save
> > >
> > > ThisWorkbook.SaveAs "H:\crawsm\MyDocuments\NewName" & Format(Date,
> > > "yyyymmdd") & ".xls"
> > >
> > > End Sub
> > > **************
> > >
> > > This will save the current copy in its location, and save a backup to the
> > > fodler / file specified with the current date in format yyyymmdd added to the
> > > file name.
> > >
> > > It also adds a confirmation request as I mentioned earlier to make sure that
> > > you actually want to save and backup before it does! Just take that out if
> > > it's not suitable for your needs.
> > >
> > > HTH
> > > DS
> > >
> > >
> > > "romelsb" wrote:
> > >
> > > > tHANKS FOR THE QUICKEST REPLY....your good...let me give specifics...I NEED A
> > > > BACKUP UP OF AT LEAST 2 file of the latest update......If i use today the
> > > > orig. file, save/close then i will have a backup file on a specified
> > > > folder....After one month, if i open>make changes>save>close the same orig.
> > > > file then i will have another backup auto filename(lets say with text date)
> > > > on the same specified folder...In this stage I have a history
> > > > back-ups....Will you help me with this because I need the orig file be used
> > > > like a template and at the same time with updated development (i.e. formula,
> > > > data, new sheets)....again thanks...more power...pls reply....
> > > > --
> > > > "Bright minds are blessed to those who share them.."-rsb.
> > > >
> > > >
> > > > "DS" wrote:
> > > >
> > > > > Hi romelsb,
> > > > >
> > > > > I take it setting the "backup" option in the SaveAs dialog box to
> > > > > automatically back up your workbook isn't sufficient?
> > > > >
> > > > > If you use the following, it'll automatically save your workbook in the
> > > > > current location, and back up your workbook to the specified location on
> > > > > close. This needs placing in the ThisWorkbook section, rather than in a
> > > > > module or sheet.
> > > > >
> > > > > ****************
> > > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > > >
> > > > > ThisWorkbook.Save
> > > > > ThisWorkbook.SaveAs "C:\BackUps\NameIt.xls", Password:="yahoo"
> > > > >
> > > > > End Sub
> > > > > ****************
> > > > > You'll obviously need to direct the path above to a valid folder, file name
> > > > > etc!
> > > > >
> > > > > WARNING: this will save the workbook on close. If you may want to close
> > > > > WITHOUT saving, add a yes/no message box to the beginning of the code to
> > > > > allow the user to exit without saving / backing up. Very useful when you're
> > > > > doing some development and you make a complete hash of things and just want
> > > > > to start again from your last save point... as I found out the hard way!!!
> > > > >
> > > > > HTH
> > > > > DS
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "romelsb" wrote:
> > > > >
> > > > > > Can anybody of good intention, program an excel workbook to provide another
> > > > > > back up file...I had many experience since 1992 wherein after saving and
> > > > > > closing my files and re-open again,,,error will appear and then it is unable
> > > > > > to read....I loss bunch of time using the good functions of excel yet the
> > > > > > program cannot fully protect the users work...I am still hoping that good
> > > > > > VBE tricks may do this ...proofcheck>save>backup>close....
> > > > > > --
> > > > > > "Bright minds are blessed to those who share them.."-rsb.

 
Reply With Quote
 
=?Utf-8?B?RFM=?=
Guest
Posts: n/a
 
      2nd Nov 2006
that's just a copy & paste issue, it's inserted a line break from here where
there shouldn't be one!

If you see in the editor:

***
Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
"Confirm Backup?")
***

then just delete the line break between the two so all that appears as a
single line. That should fix it.

HTH
DS



"romelsb" wrote:

> thanks...i had tried...see this line
> i do as instructed
> upon closing
> syntax error pop-up
> vbe opened
> then the ine below is highlighted
>
> Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
>
> pls...continue to reply
> --
> "Bright minds are blessed to those who share them.."-rsb.
>
>
> "DS" wrote:
>
> > Hi romelsb,
> >
> > OK, here we go.
> >
> > Open your Excel workbook, and along the top, click the following (each will
> > open after the other):
> >
> > Tools -> Macro -> Visual Basic Editor
> >
> > You should see a number of panes, split across the screen. On your left
> > should be a pane headed "Project - VBA Project", with a list of items below
> > it. One of these should be your item, something like "VBA Project
> > (DEVELOPER.xls)". Click on the plus symbol, and you should see some more
> > options underneath, including "Microsoft Excel Objects". Click the plus
> > symbol next to this, and you'll see a long list, of every sheet in the
> > workbook,as well as, at the bottom "ThisWorkbook".
> >
> > Double-click "ThisWorkbook" and you'll get an editor pane open up in the
> > main body. Copy the following and paste it into that pane. Then close the
> > editor, and save the workbook.
> >
> > *********************
> > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> >
> > Dim Confirm
> >
> > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > "Confirm Backup?")
> > If Confirm = vbNo Then
> > Exit Sub
> > End If
> >
> > ThisWorkbook.Save
> > ThisWorkbook.SaveAs "C:\backups\Developer_" & Format(Date, "yyyymmdd") &
> > ".xls"
> >
> > End Sub
> > *********************
> >
> > This will save the current version in place, and a copy to the folder
> > "C:\Backups" (which you'll need to create before first use), and the backup
> > copy will be named as "Developer_20061102.xls" (example as one done today, it
> > will update as per the date actioned).
> >
> > Done and done.
> > HTH
> > DS
> >
> >
> > "romelsb" wrote:
> >
> > > ooopss...so good....sorry i dont know how to place it in VBE...can u tech me
> > > just for this sake....I need the backup filename just like u
> > > formatted.....will it be like this...
> > > if filename of orig. workbook is "DEVELOPER.xls"
> > > then
> > > does the first backup will be this "DEVELOPER 2006NOV02.xls"
> > > THANKS A LOT....pls reply back...
> > >
> > > --
> > > "Bright minds are blessed to those who share them.."-rsb.
> > >
> > >
> > > "DS" wrote:
> > >
> > > > OK, that gives us a better idea!
> > > >
> > > >
> > > > If you use:
> > > >
> > > > **************
> > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > >
> > > > Dim Confirm
> > > >
> > > > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > > > "Confirm Backup?")
> > > > If Confirm = vbNo Then
> > > > Exit Sub
> > > > End If
> > > >
> > > > ThisWorkbook.Save
> > > >
> > > > ThisWorkbook.SaveAs "H:\crawsm\MyDocuments\NewName" & Format(Date,
> > > > "yyyymmdd") & ".xls"
> > > >
> > > > End Sub
> > > > **************
> > > >
> > > > This will save the current copy in its location, and save a backup to the
> > > > fodler / file specified with the current date in format yyyymmdd added to the
> > > > file name.
> > > >
> > > > It also adds a confirmation request as I mentioned earlier to make sure that
> > > > you actually want to save and backup before it does! Just take that out if
> > > > it's not suitable for your needs.
> > > >
> > > > HTH
> > > > DS
> > > >
> > > >
> > > > "romelsb" wrote:
> > > >
> > > > > tHANKS FOR THE QUICKEST REPLY....your good...let me give specifics...I NEED A
> > > > > BACKUP UP OF AT LEAST 2 file of the latest update......If i use today the
> > > > > orig. file, save/close then i will have a backup file on a specified
> > > > > folder....After one month, if i open>make changes>save>close the same orig.
> > > > > file then i will have another backup auto filename(lets say with text date)
> > > > > on the same specified folder...In this stage I have a history
> > > > > back-ups....Will you help me with this because I need the orig file be used
> > > > > like a template and at the same time with updated development (i.e. formula,
> > > > > data, new sheets)....again thanks...more power...pls reply....
> > > > > --
> > > > > "Bright minds are blessed to those who share them.."-rsb.
> > > > >
> > > > >
> > > > > "DS" wrote:
> > > > >
> > > > > > Hi romelsb,
> > > > > >
> > > > > > I take it setting the "backup" option in the SaveAs dialog box to
> > > > > > automatically back up your workbook isn't sufficient?
> > > > > >
> > > > > > If you use the following, it'll automatically save your workbook in the
> > > > > > current location, and back up your workbook to the specified location on
> > > > > > close. This needs placing in the ThisWorkbook section, rather than in a
> > > > > > module or sheet.
> > > > > >
> > > > > > ****************
> > > > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > > > >
> > > > > > ThisWorkbook.Save
> > > > > > ThisWorkbook.SaveAs "C:\BackUps\NameIt.xls", Password:="yahoo"
> > > > > >
> > > > > > End Sub
> > > > > > ****************
> > > > > > You'll obviously need to direct the path above to a valid folder, file name
> > > > > > etc!
> > > > > >
> > > > > > WARNING: this will save the workbook on close. If you may want to close
> > > > > > WITHOUT saving, add a yes/no message box to the beginning of the code to
> > > > > > allow the user to exit without saving / backing up. Very useful when you're
> > > > > > doing some development and you make a complete hash of things and just want
> > > > > > to start again from your last save point... as I found out the hard way!!!
> > > > > >
> > > > > > HTH
> > > > > > DS
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > "romelsb" wrote:
> > > > > >
> > > > > > > Can anybody of good intention, program an excel workbook to provide another
> > > > > > > back up file...I had many experience since 1992 wherein after saving and
> > > > > > > closing my files and re-open again,,,error will appear and then it is unable
> > > > > > > to read....I loss bunch of time using the good functions of excel yet the
> > > > > > > program cannot fully protect the users work...I am still hoping that good
> > > > > > > VBE tricks may do this ...proofcheck>save>backup>close....
> > > > > > > --
> > > > > > > "Bright minds are blessed to those who share them.."-rsb.

 
Reply With Quote
 
=?Utf-8?B?cm9tZWxzYg==?=
Guest
Posts: n/a
 
      2nd Nov 2006
your correct...line breaks...can u pls gave me this considering that I can
just copy and paste it on another workbooks....can u make it constant on
"orig. filename + textdate line" then I will just type in the back-up
folder....is it possible....I try to type in the real filename then save then
when i try to close the workbook...i cant click the file>close button....were
almost finish i think...pls reply...
--
"Bright minds are blessed to those who share them.."-rsb.


"DS" wrote:

> that's just a copy & paste issue, it's inserted a line break from here where
> there shouldn't be one!
>
> If you see in the editor:
>
> ***
> Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> "Confirm Backup?")
> ***
>
> then just delete the line break between the two so all that appears as a
> single line. That should fix it.
>
> HTH
> DS
>
>
>
> "romelsb" wrote:
>
> > thanks...i had tried...see this line
> > i do as instructed
> > upon closing
> > syntax error pop-up
> > vbe opened
> > then the ine below is highlighted
> >
> > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> >
> > pls...continue to reply
> > --
> > "Bright minds are blessed to those who share them.."-rsb.
> >
> >
> > "DS" wrote:
> >
> > > Hi romelsb,
> > >
> > > OK, here we go.
> > >
> > > Open your Excel workbook, and along the top, click the following (each will
> > > open after the other):
> > >
> > > Tools -> Macro -> Visual Basic Editor
> > >
> > > You should see a number of panes, split across the screen. On your left
> > > should be a pane headed "Project - VBA Project", with a list of items below
> > > it. One of these should be your item, something like "VBA Project
> > > (DEVELOPER.xls)". Click on the plus symbol, and you should see some more
> > > options underneath, including "Microsoft Excel Objects". Click the plus
> > > symbol next to this, and you'll see a long list, of every sheet in the
> > > workbook,as well as, at the bottom "ThisWorkbook".
> > >
> > > Double-click "ThisWorkbook" and you'll get an editor pane open up in the
> > > main body. Copy the following and paste it into that pane. Then close the
> > > editor, and save the workbook.
> > >
> > > *********************
> > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > >
> > > Dim Confirm
> > >
> > > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > > "Confirm Backup?")
> > > If Confirm = vbNo Then
> > > Exit Sub
> > > End If
> > >
> > > ThisWorkbook.Save
> > > ThisWorkbook.SaveAs "C:\backups\Developer_" & Format(Date, "yyyymmdd") &
> > > ".xls"
> > >
> > > End Sub
> > > *********************
> > >
> > > This will save the current version in place, and a copy to the folder
> > > "C:\Backups" (which you'll need to create before first use), and the backup
> > > copy will be named as "Developer_20061102.xls" (example as one done today, it
> > > will update as per the date actioned).
> > >
> > > Done and done.
> > > HTH
> > > DS
> > >
> > >
> > > "romelsb" wrote:
> > >
> > > > ooopss...so good....sorry i dont know how to place it in VBE...can u tech me
> > > > just for this sake....I need the backup filename just like u
> > > > formatted.....will it be like this...
> > > > if filename of orig. workbook is "DEVELOPER.xls"
> > > > then
> > > > does the first backup will be this "DEVELOPER 2006NOV02.xls"
> > > > THANKS A LOT....pls reply back...
> > > >
> > > > --
> > > > "Bright minds are blessed to those who share them.."-rsb.
> > > >
> > > >
> > > > "DS" wrote:
> > > >
> > > > > OK, that gives us a better idea!
> > > > >
> > > > >
> > > > > If you use:
> > > > >
> > > > > **************
> > > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > > >
> > > > > Dim Confirm
> > > > >
> > > > > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > > > > "Confirm Backup?")
> > > > > If Confirm = vbNo Then
> > > > > Exit Sub
> > > > > End If
> > > > >
> > > > > ThisWorkbook.Save
> > > > >
> > > > > ThisWorkbook.SaveAs "H:\crawsm\MyDocuments\NewName" & Format(Date,
> > > > > "yyyymmdd") & ".xls"
> > > > >
> > > > > End Sub
> > > > > **************
> > > > >
> > > > > This will save the current copy in its location, and save a backup to the
> > > > > fodler / file specified with the current date in format yyyymmdd added to the
> > > > > file name.
> > > > >
> > > > > It also adds a confirmation request as I mentioned earlier to make sure that
> > > > > you actually want to save and backup before it does! Just take that out if
> > > > > it's not suitable for your needs.
> > > > >
> > > > > HTH
> > > > > DS
> > > > >
> > > > >
> > > > > "romelsb" wrote:
> > > > >
> > > > > > tHANKS FOR THE QUICKEST REPLY....your good...let me give specifics...I NEED A
> > > > > > BACKUP UP OF AT LEAST 2 file of the latest update......If i use today the
> > > > > > orig. file, save/close then i will have a backup file on a specified
> > > > > > folder....After one month, if i open>make changes>save>close the same orig.
> > > > > > file then i will have another backup auto filename(lets say with text date)
> > > > > > on the same specified folder...In this stage I have a history
> > > > > > back-ups....Will you help me with this because I need the orig file be used
> > > > > > like a template and at the same time with updated development (i.e. formula,
> > > > > > data, new sheets)....again thanks...more power...pls reply....
> > > > > > --
> > > > > > "Bright minds are blessed to those who share them.."-rsb.
> > > > > >
> > > > > >
> > > > > > "DS" wrote:
> > > > > >
> > > > > > > Hi romelsb,
> > > > > > >
> > > > > > > I take it setting the "backup" option in the SaveAs dialog box to
> > > > > > > automatically back up your workbook isn't sufficient?
> > > > > > >
> > > > > > > If you use the following, it'll automatically save your workbook in the
> > > > > > > current location, and back up your workbook to the specified location on
> > > > > > > close. This needs placing in the ThisWorkbook section, rather than in a
> > > > > > > module or sheet.
> > > > > > >
> > > > > > > ****************
> > > > > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > > > > >
> > > > > > > ThisWorkbook.Save
> > > > > > > ThisWorkbook.SaveAs "C:\BackUps\NameIt.xls", Password:="yahoo"
> > > > > > >
> > > > > > > End Sub
> > > > > > > ****************
> > > > > > > You'll obviously need to direct the path above to a valid folder, file name
> > > > > > > etc!
> > > > > > >
> > > > > > > WARNING: this will save the workbook on close. If you may want to close
> > > > > > > WITHOUT saving, add a yes/no message box to the beginning of the code to
> > > > > > > allow the user to exit without saving / backing up. Very useful when you're
> > > > > > > doing some development and you make a complete hash of things and just want
> > > > > > > to start again from your last save point... as I found out the hard way!!!
> > > > > > >
> > > > > > > HTH
> > > > > > > DS
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > "romelsb" wrote:
> > > > > > >
> > > > > > > > Can anybody of good intention, program an excel workbook to provide another
> > > > > > > > back up file...I had many experience since 1992 wherein after saving and
> > > > > > > > closing my files and re-open again,,,error will appear and then it is unable
> > > > > > > > to read....I loss bunch of time using the good functions of excel yet the
> > > > > > > > program cannot fully protect the users work...I am still hoping that good
> > > > > > > > VBE tricks may do this ...proofcheck>save>backup>close....
> > > > > > > > --
> > > > > > > > "Bright minds are blessed to those who share them.."-rsb.

 
Reply With Quote
 
=?Utf-8?B?RFM=?=
Guest
Posts: n/a
 
      2nd Nov 2006
I can't remove the line breaks from here, as this is inserted by the editor
in which I'm typing at the moment!

Remove the line break on that line on your workbook, and on the line which
shows;
ThisWorkbook.SaveAs "C:\backups\Developer_" & (Date, "yyyymmdd") & ".xls"

Replace that with:
TName = Left$(ThisWorkbook.Name,Len(ThisWorkbook.Name)-4)) & "_"
ThisWorkbook.SaveAs "C:\backups\TName & Format(Date,"yyyymmdd") & ".xls"

The above should show on 2 lines (as that's what it is!), starting with
"TName" and "ThisWorkbook" respectively.
This can be used in any workbook, and will name the backup according to the
workbook name followed by the date.
e.g. Workbook "NumEdit.xls" would be backed up to "NumEdit_20061102.xls"

Once the amendments above are made, and the line breaks removed, you can
just copy and paste to any workbook you have, and it will backup on close to
the folder C:\backups according to the naming convention above.

Cheers
DS


"romelsb" wrote:

> your correct...line breaks...can u pls gave me this considering that I can
> just copy and paste it on another workbooks....can u make it constant on
> "orig. filename + textdate line" then I will just type in the back-up
> folder....is it possible....I try to type in the real filename then save then
> when i try to close the workbook...i cant click the file>close button....were
> almost finish i think...pls reply...
> --
> "Bright minds are blessed to those who share them.."-rsb.
>
>
> "DS" wrote:
>
> > that's just a copy & paste issue, it's inserted a line break from here where
> > there shouldn't be one!
> >
> > If you see in the editor:
> >
> > ***
> > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > "Confirm Backup?")
> > ***
> >
> > then just delete the line break between the two so all that appears as a
> > single line. That should fix it.
> >
> > HTH
> > DS
> >
> >
> >
> > "romelsb" wrote:
> >
> > > thanks...i had tried...see this line
> > > i do as instructed
> > > upon closing
> > > syntax error pop-up
> > > vbe opened
> > > then the ine below is highlighted
> > >
> > > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > >
> > > pls...continue to reply
> > > --
> > > "Bright minds are blessed to those who share them.."-rsb.
> > >
> > >
> > > "DS" wrote:
> > >
> > > > Hi romelsb,
> > > >
> > > > OK, here we go.
> > > >
> > > > Open your Excel workbook, and along the top, click the following (each will
> > > > open after the other):
> > > >
> > > > Tools -> Macro -> Visual Basic Editor
> > > >
> > > > You should see a number of panes, split across the screen. On your left
> > > > should be a pane headed "Project - VBA Project", with a list of items below
> > > > it. One of these should be your item, something like "VBA Project
> > > > (DEVELOPER.xls)". Click on the plus symbol, and you should see some more
> > > > options underneath, including "Microsoft Excel Objects". Click the plus
> > > > symbol next to this, and you'll see a long list, of every sheet in the
> > > > workbook,as well as, at the bottom "ThisWorkbook".
> > > >
> > > > Double-click "ThisWorkbook" and you'll get an editor pane open up in the
> > > > main body. Copy the following and paste it into that pane. Then close the
> > > > editor, and save the workbook.
> > > >
> > > > *********************
> > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > >
> > > > Dim Confirm
> > > >
> > > > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > > > "Confirm Backup?")
> > > > If Confirm = vbNo Then
> > > > Exit Sub
> > > > End If
> > > >
> > > > ThisWorkbook.Save
> > > > ThisWorkbook.SaveAs "C:\backups\Developer_" & Format(Date, "yyyymmdd") &
> > > > ".xls"
> > > >
> > > > End Sub
> > > > *********************
> > > >
> > > > This will save the current version in place, and a copy to the folder
> > > > "C:\Backups" (which you'll need to create before first use), and the backup
> > > > copy will be named as "Developer_20061102.xls" (example as one done today, it
> > > > will update as per the date actioned).
> > > >
> > > > Done and done.
> > > > HTH
> > > > DS
> > > >
> > > >
> > > > "romelsb" wrote:
> > > >
> > > > > ooopss...so good....sorry i dont know how to place it in VBE...can u tech me
> > > > > just for this sake....I need the backup filename just like u
> > > > > formatted.....will it be like this...
> > > > > if filename of orig. workbook is "DEVELOPER.xls"
> > > > > then
> > > > > does the first backup will be this "DEVELOPER 2006NOV02.xls"
> > > > > THANKS A LOT....pls reply back...
> > > > >
> > > > > --
> > > > > "Bright minds are blessed to those who share them.."-rsb.
> > > > >
> > > > >
> > > > > "DS" wrote:
> > > > >
> > > > > > OK, that gives us a better idea!
> > > > > >
> > > > > >
> > > > > > If you use:
> > > > > >
> > > > > > **************
> > > > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > > > >
> > > > > > Dim Confirm
> > > > > >
> > > > > > Confirm = MsgBox("Do you wish to save and create a backup?", vbYesNo,
> > > > > > "Confirm Backup?")
> > > > > > If Confirm = vbNo Then
> > > > > > Exit Sub
> > > > > > End If
> > > > > >
> > > > > > ThisWorkbook.Save
> > > > > >
> > > > > > ThisWorkbook.SaveAs "H:\crawsm\MyDocuments\NewName" & Format(Date,
> > > > > > "yyyymmdd") & ".xls"
> > > > > >
> > > > > > End Sub
> > > > > > **************
> > > > > >
> > > > > > This will save the current copy in its location, and save a backup to the
> > > > > > fodler / file specified with the current date in format yyyymmdd added to the
> > > > > > file name.
> > > > > >
> > > > > > It also adds a confirmation request as I mentioned earlier to make sure that
> > > > > > you actually want to save and backup before it does! Just take that out if
> > > > > > it's not suitable for your needs.
> > > > > >
> > > > > > HTH
> > > > > > DS
> > > > > >
> > > > > >
> > > > > > "romelsb" wrote:
> > > > > >
> > > > > > > tHANKS FOR THE QUICKEST REPLY....your good...let me give specifics...I NEED A
> > > > > > > BACKUP UP OF AT LEAST 2 file of the latest update......If i use today the
> > > > > > > orig. file, save/close then i will have a backup file on a specified
> > > > > > > folder....After one month, if i open>make changes>save>close the same orig.
> > > > > > > file then i will have another backup auto filename(lets say with text date)
> > > > > > > on the same specified folder...In this stage I have a history
> > > > > > > back-ups....Will you help me with this because I need the orig file be used
> > > > > > > like a template and at the same time with updated development (i.e. formula,
> > > > > > > data, new sheets)....again thanks...more power...pls reply....
> > > > > > > --
> > > > > > > "Bright minds are blessed to those who share them.."-rsb.
> > > > > > >
> > > > > > >
> > > > > > > "DS" wrote:
> > > > > > >
> > > > > > > > Hi romelsb,
> > > > > > > >
> > > > > > > > I take it setting the "backup" option in the SaveAs dialog box to
> > > > > > > > automatically back up your workbook isn't sufficient?
> > > > > > > >
> > > > > > > > If you use the following, it'll automatically save your workbook in the
> > > > > > > > current location, and back up your workbook to the specified location on
> > > > > > > > close. This needs placing in the ThisWorkbook section, rather than in a
> > > > > > > > module or sheet.
> > > > > > > >
> > > > > > > > ****************
> > > > > > > > Private Sub Workbook_BeforeClose(Cancel As Boolean)
> > > > > > > >
> > > > > > > > ThisWorkbook.Save
> > > > > > > > ThisWorkbook.SaveAs "C:\BackUps\NameIt.xls", Password:="yahoo"
> > > > > > > >
> > > > > > > > End Sub
> > > > > > > > ****************
> > > > > > > > You'll obviously need to direct the path above to a valid folder, file name
> > > > > > > > etc!
> > > > > > > >
> > > > > > > > WARNING: this will save the workbook on close. If you may want to close
> > > > > > > > WITHOUT saving, add a yes/no message box to the beginning of the code to
> > > > > > > > allow the user to exit without saving / backing up. Very useful when you're
> > > > > > > > doing some development and you make a complete hash of things and just want
> > > > > > > > to start again from your last save point... as I found out the hard way!!!
> > > > > > > >
> > > > > > > > HTH
> > > > > > > > DS
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > "romelsb" wrote:
> > > > > > > >
> > > > > > > > > Can anybody of good intention, program an excel workbook to provide another
> > > > > > > > > back up file...I had many experience since 1992 wherein after saving and
> > > > > > > > > closing my files and re-open again,,,error will appear and then it is unable
> > > > > > > > > to read....I loss bunch of time using the good functions of excel yet the
> > > > > > > > > program cannot fully protect the users work...I am still hoping that good
> > > > > > > > > VBE tricks may do this ...proofcheck>save>backup>close....
> > > > > > > > > --
> > > > > > > > > "Bright minds are blessed to those who share them.."-rsb.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 - How to stop Backup of...xlk files from xlsm files? mrjette@yahoo.com Microsoft Excel Discussion 3 26th Mar 2009 04:15 PM
Backup of excel 2007 files. Bruce Microsoft Excel Misc 8 6th Jan 2009 06:40 PM
Using a hyperlink to backup Excel files Colin Hayes Microsoft Excel Worksheet Functions 7 4th May 2007 11:06 PM
Create new excel files, Save backup of excel file Gil Microsoft Excel Programming 8 9th May 2006 09:40 PM
Excel 2003 Backup Files =?Utf-8?B?SU1UQTE=?= Microsoft Excel Misc 1 15th Dec 2005 06:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:46 AM.