Re: macro to delete a closed workbook
- From: "Nick Hodge" <nick_hodgeTAKETHISOUT@xxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 07:57:47 +0100
Tim
Why do you need to store it in the re-cycle bin? That seems a very dodgy
place to keep it. Why not rename the file in the folder each time it is
opened as 'backup' or similar. That way you'll always have the current
version and current version-1 in the folder.
Something like the code below in the ThisWorkbook module (To implement check
here http://www.nickhodge.co.uk/vba/vbaimplement.htm#eventcode)
Private Sub Workbook_Open()
Application.DisplayAlerts = False
Me.SaveCopyAs ("C:\backup" & Me.Name)
End Sub
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
nick_hodgeTAKETHISOUT@xxxxxxxxxxxxxxxxx
"Tim" <Tim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7659DCEF-C9C4-4CDA-A16C-D19961433F7C@xxxxxxxxxxxxxxxx
> Hi All,
>
> This code:
> Sub SaveBackup()
> ActiveWorkbook.SaveCopyAs "D:\My Book.xls"
> End Sub
>
> works great to save a back up copy of "My Book" but I need to change it in
> this way :
> I need first to delete "My Book" which is on drive D: before to replace it
> with the new one.
> I need to have a copy of "My Book" in my Recycle Bin because some times
> the
> new "My Book" which replaces "My Book on drive D:
> has errors on it and that's why I need to have a copy of the old "My Book"
> in the Recycle Bin before the replacement.
>
.
- References:
- macro to delete a closed workbook
- From: Tim
- macro to delete a closed workbook
- Prev by Date: Copy 1-4 sheets to a new workbook
- Next by Date: Re: Copy 1-4 sheets to a new workbook
- Previous by thread: macro to delete a closed workbook
- Next by thread: subroutine to get all of the Named range properties
- Index(es):