Hi,
Is there a way to change the 'Read-only' property of any Excel file dynamically by writing some code?
I tried 'ThisWorkbook.ReadOnly = False', but it doesn't work.
--Karan--
Hi,
Is there a way to change the 'Read-only' property of any Excel file dynamically by writing some code?
I tried 'ThisWorkbook.ReadOnly = False', but it doesn't work.
--Karan--
No, it's a read-only property.
What exactly are you trying to do?
Thanks for the prompt reply Andy.
Actually, I am trying to secure one of the add-ins that I have made (to protect against direct distribution). So, in the Auto_Open module of the add-in, I have written some code to check the user name of the user:
I have made an installer with the .xla file. Now, when the user installs, the add-in is sometimes installed as 'Read only'. So, in the third line in the above code, it gives me an error, i.e. the workbook cannot be saved. So, the entire idea of protecting the add-in from unauthorized distribution doesn't work (as the Menubar would be created only if the Username of the current computer matches with the Username of the computer on which the add-in was opened for the first time).Please Login or Register to view this content.
I hope I am clear in expressing my requirements.
Thanks for all the help!!!
Regards,
Karan
Maybe you should add error checking and not allow the addin to be used if you can not update it.
Clients using this add-in are not so tech savvy. I think they might not be able to update the add-in properties.
Do you know if there is any other alternative to change the read-only status or to protect direct distribution of the add-in?
Thank you for your time.
--Karan--
This appears to work for a normal xls file.
I used the Open Read only option on the Open dialog when testing.Please Login or Register to view this content.
One thing that may be a problem is if the addin is in a shared folder where the user only has read-only access. Then you would not have the privilge to overwrite your addin.
Hi Andy,
Thanks for the help.
In the .xla, I am getting the following error, on the line 'ThisWorkbook.SaveCopyAs ThisWorkbook.FullName' : "Cannot access read-only document" 'File Name.xla'
Do you know a way to get over this?
I tried working with this code on a .xls file too, but it gives the same error. If you have a sample file, can you please attach it?
Regards,
Karan
Last edited by karan; 05-22-2009 at 09:18 AM. Reason: more information
As I said.
"One thing that may be a problem is if the addin is in a shared folder where the user only has read-only access. Then you would not have the privilge to overwrite your addin."
This is not an excel issue so much as an OS one. The actual fill is marked as read-only rather than just being opened as read-only.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks