I would like to save an excel file with read-only option.
Are there any better ways to do that other than keep clicking buttons?
Thank you!
I would like to save an excel file with read-only option.
Are there any better ways to do that other than keep clicking buttons?
Thank you!
You could try this…
Script:
System.IO.File.SetAttributes(filePath, System.IO.File.GetAttributes(filePath) Or FileAttributes.ReadOnly)
Example:
It worked! Thank you so much!!!
Thank you so much! It was very helpful!!
Hi
I want to remove the read-only attribute, and I replaced “readonly” with “Normal”, but it did not remove read-only attribute.
System.IO.File.SetAttributes(filePath, System.IO.File.GetAttributes(filePath) Or FileAttributes.Normal)
I get an error when updating the file.
The error is access to the path is denied.
How do I remove read-only??
What I want to do is:
Everyday a robot updates an excel file and make a copy of it.
I want to make the copied file to be read-only so that the file will not be updated accidentally.
But the filename is always same, and updated, I need to remove read-only first and then overwrite, and make the file read-only again.
I use to Copy File activity (Overwrite checked).
To remove read only, change the script to this:
System.IO.File.SetAttributes(filePath, System.IO.File.GetAttributes(filePath) Xor FileAttributes.ReadOnly)
Essentially ‘Or’ will add the read only attribute and ‘Xor’ will remove it.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.