Password not working - SaveAs method

tjharlan

Board Regular
Joined
May 8, 2004
Messages
63
Hi,

Using the following code,

Workbooks("SCFA_Macro.xls").SaveAs "C:\test.xls", , , writerespassword = "nobreaks", ReadOnlyRecommended:=True

I am able to save the open workbook ("SCFA_Macro.xls) as "test.xls". I want to make the file Write-protected...and this works fine. When I close and try to reopen the newly created "test.xls" file, the password "nobreaks" does not work. I've quadruple checked such things as caps lock, spelling, etc. and cannot determine what the problem.

Any ideas?

Thanks.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi

I think you missed the colon before your password

Workbooks("SCFA_Macro.xls").SaveAs "C:\test.xls", writerespassword:="nobreaks", ReadOnlyRecommended:=True


HTH

Regards
 
Upvote 0

Forum statistics

Threads
1,207,401
Messages
6,078,261
Members
446,324
Latest member
JKamlet

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