Save As ReadOnly

andyjames

Board Regular
Joined
May 15, 2007
Messages
133
I have the following code as I wish to save a file with a password (using the variable 'FILENAME' but enable users to open the files as ReadOnly).

ActiveWorkbook.SaveAs filename:="z:\finance\travel\authorised forms\" & filename & ".xls", ReadOnly:=True, Password:=filename

I get the error
"Compile Error - Name Argument not Found"

Can anyone advise?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
andy

I can give you 1 piece of advice, don't use something like filename as a variable.:)

Also there is no ReadOnly argument for the SaveAs method.

There is ReadOnlyRecommended but I'm not sure if it'll do what you want, which isn't clear anyway.:)

If a file has a password then that is needed however you open the file, unless you use code for that.
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top