Code: Select all
Sub test()
Dim strFullName As String
strFullName = ThisDocument.FullName
Dim lngFA
lngFA = GetAttr(strFullName)
SetAttr strFullName, vbReadOnly
lngFA = GetAttr(strFullName)
End Sub
Makes sense.
We just saved it, didn't we?
The next setting of "lngFA =" tells you 1, that is, read-only, and yep, we just set that didn't we?
But what on earth has happened to the Archive bit?
I ran the code again checking in File Explorer with right-click properties and saw the archive bit disappear as the R-O bit was turned on.
I rather think that marking a file read-only is, in many ways, an indication of the file's importance.
So I figure that backing up the file ought to be extra-specially important too.
I'm just saying ....