Windows Version - tested
Sub NormalBackup()
' Run to Backup Normal template to dated backup
' Charles Kenyon 10 Jan 2020
' http://www.addbalance.com/word/normal-backup.htm
' Appends date to "Normal Backup" when saving, saves in
special folder,
' then returns save path to current - thanks to
Jay Freedman for that
'
On Error Resume Next
Dim strName As String
Dim intLenPath As Integer ' length of path to templates
folder without name of folder
Dim strPath As String 'Holder for current path
Dim strStorePath As String
'
Let intLenPath =
InStrRev(Application.Options.DefaultFilePath(wdUserTemplatesPath),
"\")
Let strStorePath =
Left(Application.Options.DefaultFilePath(wdUserTemplatesPath),
intLenPath)
Let strStorePath = strStorePath & "Normal Backups"
'
' Check if folder exists, if not, create it
If Dir(strStorePath) = vbNullString Then MkDir (strStorePath)
'
Let strPath =
Application.Options.DefaultFilePath(wdDocumentsPath)
Let strName = "Normal Backup"
' add date & Time
Let strName = strName & " " & Format((Year(Now() + 1) Mod
100), "20##") & "-" & _
Format((Month(Now() + 1) Mod 100), "0#") & "-" & _
Format((Day(Now()) Mod 100), "0#") & "-" & _
Format(Now(), "HH_mm") 'add date & time
'
' Do the save
' MsgBox strStorePath & strName & ".dotm"
ThisDocument.Save 'save normal template (code holder) itself
ThisDocument.SaveAs2 FileName:=strStorePath & "\" & strName
& ".dotm", Addtorecentfiles:=False
' Reset save path
Let Application.Options.DefaultFilePath(wdDocumentsPath) =
strPath
'
' reset error message
On Error GoTo -1
End Sub
Version for Mac - not tested
Sub NormalBackup()
' Run to Backup Normal template to dated backup
' Charles Kenyon 10 Jan 2020
' http://www.addbalance.com/word/normal-backup.htm
' Appends date to "Normal Backup" when saving, saves in
special folder,
' then returns save path to current - thanks to Jay
Freedman for that
'
On Error Resume Next
Dim strName As String
Dim intLenPath As Integer ' length of path to templates
folder without name of folder
Dim strPath As String 'Holder for current path
Dim strStorePath As String
'
Let intLenPath =
InStrRev(Application.Options.DefaultFilePath(wdUserTemplatesPath),
":")
Let strStorePath =
Left(Application.Options.DefaultFilePath(wdUserTemplatesPath),
intLenPath)
Let strStorePath = strStorePath & "Normal Backups"
'
' Check if folder exists, if not, create it
If Dir(strStorePath) = vbNullString Then MkDir (strStorePath)
'
Let strPath =
Application.Options.DefaultFilePath(wdDocumentsPath)
Let strName = "Normal Backup"
' add date & Time
Let strName = strName & " " & Format((Year(Now() + 1) Mod
100), "20##") & "-" & _
Format((Month(Now() + 1) Mod 100), "0#") & "-" & _
Format((Day(Now()) Mod 100), "0#") & "-" & _
Format(Now(), "HH_mm") 'add date & time
'
' Do the save
' MsgBox strStorePath & strName & ".dotm"
ThisDocument.Save 'save normal template (code holder) itself
ThisDocument.SaveAs2 FileName:=strStorePath & ":" & strName
& ".dotm", Addtorecentfiles:=False
' Reset save path
Let Application.Options.DefaultFilePath(wdDocumentsPath) =
strPath
' reset error message
On Error GoTo -1
End Sub
If you use the Mac version,
please write to me and let me know if it works for you. It
should, but I do not have a Mac available to test it.