Reminder for backup

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I have a macro which creates a backup of my workbook.

I now need a macro which will display a message if that
backup macro has not been run within say the last 7 days.
Can this be done with VBA?

Thanks
 
Bob,

Try something like this.

Sub Lastruntime()
Application.ScreenUpdating = False
Worksheets("sheet1").Activate
If Range("a2").Value <= Date - 7 Then<< this sets the nr of days
MsgBox "Last Backup was on: " & Range("a2").Value
End If
End Sub

after backup is done set Range("A2"). Value = Date

HTH

Charle
 
Application.Displayalerts = False
Thisworkbook.SaveCopyAs _
filename:="C:\MyBackups\ & thisworkbook.Name
Application.displaAlerts = True
 

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