yes it is possible
you can use vba statement SetAttr
SetAttr "TESTFILE", vbHidden ' Set hidden attribute.
' Set hidden and read-only
SetAttr "TESTFILE", vbHidden + vbReadOnly
Function MakeFileReadOnly(ByVal sFile As String)
Dim strSaveFilename As String
Dim oFSO As Object
'Scripting.FileSystemObject Dim oFile As Object
' Create Objects
' Uses Late Binding
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.GetFile(FilePath:=sFile)
'Set file to be read-only
oFile.Attributes = 1
' Releasing Objects
If Not oFSO Is Nothing Then Set oFSO = Nothing
If Not oFile Is Nothing Then Set oFile = Nothing
I'm not sure what to do with the code. I'm not very knowledgeable on macros.
Yes it can b e done but the file will have to be closed IMO to set the attributes from readonly to normal and then back to readonly.
With that said, it all can be done via a macro i.e. once you activate the file (make it current active file) and run the macro. Then macro would close it, remove readonly and open it again. You make the changes and then macro will close it, set to readonly and open again. I should mention that macro would keep running in the background and would wait until you close it to process further.