How to Periodically Back Up Multiple Revisions of Your Word Document

In this article, we will focus on introducing you the way to periodically back up multiple reversions of your Word document.

In one of our previous article, we’ve shared with you 2 ways to back up document periodically at the same time interval. For detailed information, you can refer to this article: 2 Quick Ways to Auto Back up Your Word Document Periodically

But as you may notice, there is and will always be one backup copy only. The new version of backup will always overwrite the older one. This keeps your folder in a clean manner. But, you will have difficulty finding the previous versions of the document.

To address this issue, we offer you another macro, which will periodically back up multiple revisions of your Word document. So you will always have something to refer to.Periodically Back Up Multiple Revisions of Your Word Document

Multiple Backup Revisions for a Word Document

  1. First of all, click “Developer” tab and then the “Visual Basic” to invoke the VBA editor. Or just press “Alt+ F11” if you prefer.Click "Developer"->Click "Visual Basic"
  2. Next click “Normal” in the left column.
  3. Then click “Insert” tab on menu bar.
  4. Choose “Module” on the drop-down menu.Click "Normal"->Click "Insert"->Click "Module"
  5. Next double click to open the module and paste the following codes:
Public strbackuptime As String
Public strBackupPath As String
Public nNumber As Integer

Sub AutoOpen()
  Dim nReturnValue As Integer

  nNumber = 0
  nReturnValue = MsgBox("Do you want to open AutoBackupDocument?", 4, "welcome")
  If nReturnValue = 6 Then
    strBackupPath = InputBox("Enter the backup path", "Backup Path", "For example:E:\Temp\test")
    strbackuptime = InputBox("Enter the backup time", "Backup Time", "For example:00:00:10")
    '  strBackupPath = "E:\Temp\test"
    '  strbackuptime = "00:00:10" 
    Call AutoBackupDocument
  End If
End Sub

Sub AutoBackupDocument()
  Dim dtNewBackupTime As Date
  Dim strFilePath, strFileName As String
  Dim strFileFormate As String

  strFileFormat = Right(ActiveDocument.Name, 4)
  dtNewBackupTime = Now + TimeValue(strbackuptime)
  nNumber = nNumber + 1
  strFilePath = ActiveDocument.Path
 
  '  Check if the document is a doc/docx file.
  If StrComp(strFileFormat, ".doc", vbTextCompare) = 0 Then
    strFileName = Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4)
    ChangeFileOpenDirectory strFilePath
    ActiveDocument.SaveAs FileName:=strBackupPath & "\" & strFileName & "_backup" & nNumber & strFileFormat, ReadOnlyRecommended:=True
    ActiveDocument.SaveAs FileName:=strFileName & strFileFormat, ReadOnlyRecommended:=False
  Else
    If StrComp(strFileFormat, "docx", vbTextCompare) = 0 Then
      strFileName = Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 5)
      ChangeFileOpenDirectory strFilePath
      ActiveDocument.SaveAs FileName:=strBackupPath & "\" & strFileName & "_backup" & nNumber & "." & strFileFormat, ReadOnlyRecommended:=True
      ActiveDocument.SaveAs FileName:=strFileName & "." & strFileFormat, ReadOnlyRecommended:=False
    End If
  End If

  Application.OnTime When:=dtNewBackupTime, Name:="AutoBackupDocument"
  '  CreateObject("Wscript.shell").popup "An new backup:" & strFileName & "_backup" & nNumber & "." & strFileFormat, 2, "Auto close this box after 2s"
End Sub
  1. Then click “Save” to save the codes.Paste Codes->Click "Save"
  2. Next time you open a saved document, there will be a dialog box, asking if you want to activate the auto backup function. Click “Yes” to turn the macro on, and “No” to stop it.Click Either "Yes" or "No"
  3. There is the “Backup path” box after the click on “Yes” button. Enter the address where you want to store backup files. Click “OK”. Note there is no need to add extra “\” to the address.Enter Backup File Address->Click "OK"
  4. In the second box open, enter the time interval for backup. Follow the format of “hh:mm:ss”. For example, “00:30:00” means to back up document every 30 minutes. Click “OK”.Enter the Back up Time Interval Value
  5. If you have a fixed path and time interval for the backup activity, you can alter the following lines of codes.
  • Delete bellowing 2 lines of codes in “AutoOpen” macro:
strBackupPath = InputBox("Enter the backup path", "Backup Path", "For example:E:\Temp\test")

and

strbackuptime = InputBox("Enter the backup time", "Backup Time", "For example:00:00:10")
  • Remove the single quotation mark before
'strBackupPath = "E:\Temp\test"

Replace the address with actual folder path inside the quotation marks.

  • Remove the single quotation mark before
'strbackuptime = "00:00:10"

Enter time interval value inside the quotation marks.

  1. Then you will achieve the result as follows:Backup Files
  2. You can choose to remove the single quotation mark before
'CreateObject("Wscript.shell").popup "An new backup:" & strFileName & "_backup" & nNumber & "." & strFileFormat, 2, "Auto close this box after 2s"

Then after each backup file being created, there will be an indicating box which will be closed in 2 seconds automatically, such as bellow:An Indicating Box

Battle with Hard Word Issues

On the whole, Word turns out quite helpful in our daily work. But, you must aware that it can collapse from time to time. Whenever you end up with the need of doc repair, never give up. Go to choose a tool and have a try. Surprisingly, you will have a great chance of bringing it back to life.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xlsx fix and pdf repair software products. For more information visit www.datanumen.com

Comments are closed.