
Originally Posted by
p45cal
Ah but, ah but, ah but: MS doesn't always tell the truth; if the OP is correct that his first macro snippet works swimmingly, then the built-in document property Last Author is read/write!
1. Ahh -- I suspect that it the COLLECTION DocumentProperties that is Read Only then, and not the Items
2. Some properties are update-able, but some are not - couldn't find a list, so it's trial and error time
Capture.JPG
3. I thought I'd try to be clever and change the system time, save the file, and reset the system time, but couldn't get this to work
Option Explicit
Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Dim lpSystemTime1 As SYSTEMTIME, lpSystemTime2 As SYSTEMTIME
Declare PtrSafe Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Sub SaveWithOldDateTime()
With lpSystemTime1
.wYear = 2000
.wMonth = 1
.wDayOfWeek = -1
.wDay = 1
.wHour = 1
.wMinute = 1
.wSecond = 0
.wMilliseconds = 0
End With
With lpSystemTime2
.wYear = Year(Now)
.wMonth = Month(Now)
.wDayOfWeek = -1
.wDay = Day(Now)
.wHour = Hour(Now)
.wMinute = Minute(Now)
.wSecond = Second(Now)
.wMilliseconds = 0
End With
'set the new time
SetSystemTime lpSystemTime1
ThisWorkbook.Save
SetSystemTime lpSystemTime2
ThisWorkbook.Saved = True
ThisWorkbook.Close
End Sub