I am trying to use code in a VBA macro to change my file to a read-only file at the end of the macro after I've done a few other things to the file. I'm using this line of code:
ActiveWorkbook.ChangeFileAccess xlReadOnly
This code does in fact change the file to read-only. After the macro finishes I see "Read-Only" in the title of the file. However, when I close the file and re-open it the file is no longer read only.
I've tried changing the code to this:
ActiveWorkbook.ChangeFileAccess xlReadOnly
ActiveWorkbook.Save
But that doesn't work because it tells me I can't save the file after it's been converted to read-only.
Any ideas?
Thanks,
JK
ActiveWorkbook.ChangeFileAccess xlReadOnly
This code does in fact change the file to read-only. After the macro finishes I see "Read-Only" in the title of the file. However, when I close the file and re-open it the file is no longer read only.
I've tried changing the code to this:
ActiveWorkbook.ChangeFileAccess xlReadOnly
ActiveWorkbook.Save
But that doesn't work because it tells me I can't save the file after it's been converted to read-only.
Any ideas?
Thanks,
JK