0

Is there a way, setting, macro, or otherwise, that can automatically create backups of the current document in a series? Such as, working on a Writer document, pressing a macro button, and creating a backup at that time, so that there is another backup added to the previous backups in a folder?

solologos
  • 3
  • 1
  • Seeing beyond the own nose, what about using [Git](https://git-scm.org) or any other revision control system? You'll learn something to use with any type of file and application. – the busybee Jan 29 '21 at 17:55

1 Answers1

0

Well, try this

Sub createBackUp()
Dim sURL As String
Dim aURL As Variant
Dim saveTime As String
  sURL = ThisComponent.getURL()
  If Trim(sURL) = "" Then Exit Sub  ' No name - cannot store
  saveTime = "_" & FORMAT(Now,"YYYYMMDD\_HHmmSS")
  aURL = Split(sURL, ".")
  If UBound(aURL) < 1 Then  ' No extention?
    sURL = sURL & saveTime
  Else
    aURL(UBound(aURL)-1) = aURL(UBound(aURL)-1) & saveTime
    sURL = Join(aURL,".")
  EndIf
  On Error Resume Next
  ThisComponent.storeToURL(sURL,Array())
  On Error GOTO 0
End Sub

Also you can try Timestamp Backup

JohnSUN
  • 2,268
  • 2
  • 5
  • 12