Script to backup and rename excel workbook

  • Thread starter Thread starter lobster
  • Start date Start date
L

lobster

I plan to use a row delete script (I have this already) to get rid of
old data here at work. Before I run this though (I will be running it
fairly frequently) I thought I should backup the file I am working on.

Is it possible to write a script which creates a backup of the current
Excel file I am working on, without changing the filename of the 'live'
workbook, and which names the backup file with the time and date so it
is both unique and also searchable (EG 03122003-1645.xls or similar) ?

Ideally I would combine the two scripts so that once the script is run
a backup is created and then the rows are deleted subject to my
criteria. Basically if I forget to back up and then delete the data in
error it could cost me my job.

Any thoughts welcome !!
TIA
 
Here is a sub I use to make a backup from any folder I am in. Modify to
suit.

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

--
Don Guillett
SalesAid Software
(e-mail address removed)
lobster said:
I plan to use a row delete script (I have this already) to get rid of
old data here at work. Before I run this though (I will be running it
fairly frequently) I thought I should backup the file I am working on.

Is it possible to write a script which creates a backup of the current
Excel file I am working on, without changing the filename of the 'live'
workbook, and which names the backup file with the time and date so it
is both unique and also searchable (EG 03122003-1645.xls or similar) ?

Ideally I would combine the two scripts so that once the script is run
a backup is created and then the rows are deleted subject to my
criteria. Basically if I forget to back up and then delete the data in
error it could cost me my job.

Any thoughts welcome !!
TIA


------------------------------------------------



~~Now Available: Financial Statements.xls, a step by step guide to
creating financial statements
 

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

Back
Top