auto backup Word file periodically

Discussion in 'General Questions' started by Blanchec, May 9, 2017.

  1. Blanchec

    Blanchec Bit poster

    Messages:
    2
    Hello.

    I know that I can backup Word files when saving and closing your file by checking "Always create backup copy" box in Word Options.
    But can I make it auto backup periodically ? For example, every 5 minutes when I'm editing the file . It will much more safer to me. Any help will be appreciated.
     
  2. Arun@Parallels

    Arun@Parallels Parallels Support

    Messages:
    1,257
    Hi @Blanchec , there is not option in Microsoft Word to back up periodically, however please check with Microsoft office support and check if they have any alternate work around for this.
     
  3. andream4

    andream4 Bit poster

    Messages:
    1
    Hi,Blanchec

    For that , maybe you can write VBA codes to do that for you. Here is a sample you can try.

    Code:
    Sub AutoOpen()
      Dim strBackupPath As String
      nReturnValue = MsgBox("Do you want to open AutoBackupDocument?", 4, "Auto Backup Document")
      If nReturnValue = 6 Then
        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)
      If StrComp(strFileFormat, ".doc", vbTextCompare) = 0 Then
        dtNewBackupTime = Now + TimeValue("00:05:00") ' Change the "00:05:00" to the real backup interval time you want.
        strFilePath = ActiveDocument.Path
        strFileName = Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4)
        ChangeFileOpenDirectory strFilePath
        ActiveDocument.SaveAs FileName:="C:\Users\Public\Documents\New folder\Test2\" & strFileName & "_backup.doc", ReadOnlyRecommended:=True ' Change the "C:\Users\Public\Documents\New folder\Test2\" as the real path which you need to put the backup file.
        ActiveDocument.SaveAs FileName:=strFileName & ".doc", ReadOnlyRecommended:=False
        Application.OnTime When:=dtNewBackupTime, Name:="AutoBackupDocument"
        CreateObject("Wscript.shell").popup "An new backup:" & strFileName & "_backup.doc", 2, "Auto close this box after 2s"
        Else
        If StrComp(strFileFormat, "docx", vbTextCompare) = 0 Then
          dtNewBackupTime = Now + TimeValue("00:05:00") ' Change the "00:05:00" to the real backup interval time you want.
          strFilePath = ActiveDocument.Path
          strFileName = Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 5)
          ChangeFileOpenDirectory strFilePath
          ActiveDocument.SaveAs FileName:="C:\Users\Public\Documents\New folder\Test2\" & strFileName & "_backup.docx", ReadOnlyRecommended:=True ' Change the "E:\Temp\backup\" as the real path which you need to put the backup file.
          ActiveDocument.SaveAs FileName:=strFileName & ".docx", ReadOnlyRecommended:=False
          Application.OnTime When:=dtNewBackupTime, Name:="AutoBackupDocument"
          CreateObject("Wscript.shell").popup "An new backup:" & strFileName & "_backup.docx", 2, "Auto close this box after 2s"
        End If
      End If
    End Sub
    You can find more details at

    https://www.datanumen.com/blogs/2-quick-ways-auto-back-word-document-periodically/

    Good luck.
     
    Last edited: May 18, 2017
    Blanchec likes this.
  4. Hemnath@Parallels

    Hemnath@Parallels Parallels Support

    Messages:
    1,003
    Appreciate the information. Thank you.
     
  5. Blanchec

    Blanchec Bit poster

    Messages:
    2
    Thanks a lot! I almost give up for that ! Thanks for all your time!
     
  6. Ajith1

    Ajith1 Parallels Support

    Messages:
    2,534
    Feel free to reach us anytime for support or questions related to Parallels products.
     

Share This Page