ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving it as read only? (https://www.excelbanter.com/excel-programming/294952-saving-read-only.html)

andycharger[_24_]

Saving it as read only?
 
Can someone help me?

Im trying to save a spreadsheet as read only.
However, When I look through the options on the code in VBA, I canno
see an option for read only? Only Read Only Recommended.

I tried setting the Activeworkbook.Writepassword = "password"
but this just prevents me saving the spreadsheet altogether as it say
it cannot access read only document "Quotes 2004"


Here is my code

Activeworkbook.Writepassword = "password"

chdir "C:\"

ActiveWorkBook.Saveas Filename :="Y:\working files\quotes2004.xls"
FileFormat:=xlNormal, Password:="", readonlyrecommended="false"


Any ideas

--
Message posted from http://www.ExcelForum.com


kkknie[_30_]

Saving it as read only?
 
Not sure the exact reason for wanting it to be read only, but here'
some suggestions.

- Protect the workbook with a password. Then the user will not be abl
to make any changes (so saving it would not matter).

- Save the workbook to a directory that the users only hav
Read/Execute privelage. (my preference)



--
Message posted from http://www.ExcelForum.com


andycharger[_25_]

Saving it as read only?
 
In my example, it is setting the file to have a password if you look a
the VBA but that is not sufficient.

I have found out that I need to do the following:

SetAttr filename, vbReadOnly

but i need to delete the original file first as it wont let m
overwite

Anyone know how I delete the original file without opening it?

Any hlep would be appreciated

--
Message posted from http://www.ExcelForum.com


kkknie[_33_]

Saving it as read only?
 
Kill "Filename.xls"



--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Saving it as read only?
 
I don't know if you want a password or not, but having a password doesn't
have much to do with readonly.

for readonly , save the workbook as normal, close it, then use the setattr
to mark it as read only. See VBA help for arguments to setattr.

--
Regards,
Tom Ogilvy


"andycharger " wrote in message
...
Can someone help me?

Im trying to save a spreadsheet as read only.
However, When I look through the options on the code in VBA, I cannot
see an option for read only? Only Read Only Recommended.

I tried setting the Activeworkbook.Writepassword = "password"
but this just prevents me saving the spreadsheet altogether as it says
it cannot access read only document "Quotes 2004"


Here is my code

Activeworkbook.Writepassword = "password"

chdir "C:\"

ActiveWorkBook.Saveas Filename :="Y:\working files\quotes2004.xls",
FileFormat:=xlNormal, Password:="", readonlyrecommended="false"


Any ideas?


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com