title: Macro to make a backup while saving a file
body: <p>I would like to have a macro which automatically makes the backup of my file to a different folder when it is being saved. I have found a working macro but it makes a copy each time when I run it (not automatically when file is being saved). Could anyone help me to amend the macro code to work as I described?</p>
  
  <p>MACRO I HAVE:</p>
  
  <pre><code>Sub Auto_Save()
  
  Dim savedate
  
  savedate = Date
  
  Dim savetime
  savetime = Time
  Dim formattime As String
  formattime = Format(savetime, "hh.MM.ss")
  Dim formatdate As String
  formatdate = Format(savedate, "DD - MM - YYYY")
  
  Application.DisplayAlerts = False
  
  Dim backupfolder As String
  backupfolder = "Z:\My Documents\"
  ActiveWorkbook.SaveCopyAs Filename:=backupfolder &amp; formatdate &amp; " " &amp; formattime &amp; " " &amp; ActiveWorkbook.Name
  ActiveWorkbook.Save
  Application.DisplayAlerts = True
  MsgBox "Backup Run. Please Check at: " &amp; backupfolder &amp; " !"
  
  End Sub
  </code></pre>