I'm trying to create a Word macro that saves the current document without changing the "Date Modified" property.
However, it seems that whenever I save the document using the SaveAs method, the "Date Modified" property is updated to the current date and time.
I've done some research and it seems that this is the default behavior of the SaveAs method in Word. When you save a document using this method, Word creates a new file with a new file path, and the "Date Modified" property is automatically updated to the current date and time.
However, I need to find a way to save a copy of the document without changing the "Date Modified" property. I've tried using the FileSystemObject in VBA to copy the file, but this also updates the "Date Modified" property.
Has anyone found a way to save a currently opened Word document without changing the "Date Modified" property? Any help or advice would be greatly appreciated!
Here's the code I'm currently using to save a copy of the document:
Code: Select all
Sub SaveDocwithoutDMP()
Dim docName As String
Dim fileSaveName As String
Dim filePath As String
docName = ActiveDocument.Name
filePath = Left(docName, InStrRev(docName, "\"))
fileSaveName = Left(docName, InStrRev(docName, ".") - 1) & "_Copy" & Right(docName, Len(docName) - InStrRev(docName, "."))
ActiveDocument.SaveAs FileName:=filePath & fileSaveName
End Sub