Saving twice

  • Thread starter Thread starter Chuck
  • Start date Start date
C

Chuck

Hello,

We have a spreadsheet that has a lot of lab information in it. When I close
it, I always get the screen that asks if I want to save the changes. Well I
would like to save the spreadsheet into two different directories so I have
a backup.

Any help would be appreciated.

Chuck
 
Chuck

Right-click on Excel Icon to left of "File" if Window is maximized,
right-click on Excel icon at left side of title bar if Window is not
maximized.

Select "View Code". Copy/paste the code in there.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveWorkbook.SaveCopyAs Filename:="E:\GordStuff\Backup\" & _
ActiveWorkbook.Name
End Sub

When Excel asks "do you want to save changes?" hit yes and you will save the
workbook in default location as well as in your backup folder, which would not
be GordStuff\Backup, I assume.

Edit the path to suit.

Gord Dibben Excel MVP
 
Here is what I use

Sub Backup() 'kept in personal.xls & assigned to toolbar button
On Error GoTo BackupFile
MkDir CurDir & "\Backup"
BackupFile:
With ActiveWorkbook
MyWB = .Path & "\BACKUP\" & .Name
.SaveCopyAs MyWB
.Save
End With
End Sub
 
I just wanted to get back to you, that I haven't had a chance to use the
macro due to being out of state. But its exactly what I need and thanks to
you both.

Chuck
 
Back
Top