Saving it as read only?

  • Thread starter Thread starter andycharger
  • Start date Start date
A

andycharger

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
 
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)
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Simplify save code 11
Save as Read only 2
Hiding an Excel file using VBA 1
Save as marco 3
save as - to any desktop 2
SaveAs to existing file 5
Save As File Format 1
Save with ref. to cell A1 2

Back
Top