How do I save/update work to appear in 2 seperate files?

D

Dodeka1

Each time I save my work I want it to save to two seperate files, without
having to cut and paste the new version across each time. Is this possible?
The shared drive and to my computer.
 
F

FSt1

hi
yes it is. you request is not uncommon. lots of people want to create a
backup as they work. the solution is a duel save. the code i am about to
paste is workbook level code meaning that you will have to paste in a
thisworkbook module. you will also have to replace my file paths with your
file paths. post back if you need further help.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.DisplayAlerts = False
ChDir "E:\Excel\CodeStuff"
ActiveWorkbook.SaveAs Filename:="E:\Excel\CodeStuff\deleteme.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ChDir "C:\Program Files\Microsoft Office\Office10\XLStart"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and settings\deleteme.xls", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False
Application.DisplayAlerts = True
End Sub

rergards
FSt1
 
B

Bob Phillips

Caters for both Save and SaveAs

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim sFile
Application.EnableEvents = False
Cancel = True
If SaveAsUI Then
sFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If sFile <> False Then
With ThisWorkbook
.SaveAs sFile
.SaveCopyAs .Path & Application.PathSeparator & _
Left(.Name, InStrRev(.Name, ".") - 1) & "_Backup"
End With
End If
Else
With ThisWorkbook
.Save sFile
.SaveCopyAs .Path & Application.PathSeparator & _
Left(.Name, InStrRev(.Name, ".") - 1) & "_Backup"
End With
End If
Application.EnableEvents = True
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Top