Backup specifications

J

jvine

Hi again,
My other problem is how to make the current "backup" macro include the
ability to automatically save itself every 60 minutes to a different
location than the original file?
Thanks,
Nene.

--------------------------------------------------------------------------------
Sub Backup()
'
' Backup Macro
'
'

Dim sFileName$
Application.ScreenUpdating = False
sFileName = ThisWorkbook.Path & "\" & Format(Date, "ddmmyyyy") &
".xls"
Sheets("Barcodes").Select
ActiveSheet.Copy
'ActiveSheet.Buttons(1).Delete

ActiveWorkbook.SaveAs sFileName, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=True

ActiveWorkbook.Close savechanges:=False
MsgBox "The Barcodes for Form Checks have been saved as " &
sFileName & "!"
Application.ScreenUpdating = True

End Sub
 
J

JE McGimpsey

one way:

Public Sub Backup()
Const MSGSTR As String = _
"The Barcodes for Form Checks have been saved as $$!"
Const PATH2 As String = "<your path here>"
Dim sFileName$
Dim sFilename2$
sFileName = ThisWorkbook.Path & Application.PathSeparator & _
Format(Date, "ddmmyyyy") & ".xls"
sFileName = PATH2 & Application.PathSeparator & _
Format(Date, "ddmmyyyy") & ".xls"
With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With
Sheets("Barcodes").Copy
With ActiveWorkbook
.SaveAs _
Filename:=sFileName, _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=True
.SaveAs _
Filename:=sFilename2, _
CreateBackup:=True
.Close SaveChanges:=False
End With
MsgBox Application.Substitute(MSGSTR, "$$", sFileName)
With Application
.OnTime Now + TimeSerial(1, 0, 0), "Backup"
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub

Note that there isn't any provision for turning off the OnTime call. You
may want to look at Chip Pearson's site for some more sophisticated
OnTime control, depending on your needs:

http://cpearson.com/excel/ontime.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to work on a new worksheet 3
Simplify save code 11
assigning macro 2
Assign macro 2
assign macro - toolbar 2
Calling Save 1
File SaveAs 1
Save As Macro 3

Top