View Single Post
 
Old 08-04-2020, 06:32 AM
Kain Kain is offline Windows 10 Office 2019
Novice
 
Join Date: Aug 2020
Posts: 2
Kain is on a distinguished road
Default

This is EXACTLY what I was looking for !!

Thank you very much.


My macros are:

Sub AutoClose()

'
' When closing document, saves with original name + location,
' then to D:\reservekopie\finalcopy+date+time
'
'

Dim strPath, strFile As String

strPath = "D:\reservekopie" 'set path
strFile = "finalcopy_" 'set filename


ActiveDocument.Save
ActiveDocument.SaveAs FileName:=strPath & strFile & _
Format((Date), " ddMMMMyyyy ") & Format((Time), "HHumm")
ActiveWindow.Close
Selection.HomeKey Unit:=wdLine
WordBasic.DisableAutoMacros 0 'Enables Auto Macros

End Sub


Sub Sparecopy()
'
' makes copy of content, saves to D:\reservekopie\workingcopy+date+time
'
'
WordBasic.DisableAutoMacros 1 'Disables Auto Macros

Dim strPath, strFile As String
Selection.WholeStory
Selection.Copy
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
Selection.PasteAndFormat (wdFormatOriginalFormatting)

strPath = "D:\reservekopie" 'set path
strFile = "workingcopy" 'set filename

ActiveDocument.SaveAs FileName:=strPath & strFile & _
Format((Date), " ddMMMMyyyy ") & Format((Time), "HHumm") & Format(Order, "_00#")
ActiveWindow.Close
Selection.HomeKey Unit:=wdLine

WordBasic.DisableAutoMacros 0 'Enables Auto Macros

End Sub
Reply With Quote