Setting Macro to save write-restricted workbook

K

Kate

Hello,

I have a macro that is built to 1)update a report daily,
then 2)save it to two different locations (into two
workbooks). I need both to be password protected to
modify. The end of the macro looks something like this:

ChDir "G:\WIL"
ActiveWorkbook.SaveAs Filename:= _
"G:\WIL\Wrkbk.xls", _
FileFormat:=xlNormal, Password:="",
WriteResPassword:="orange", _
ReadOnlyRecommended:=False, CreateBackup:=True
ChDir "G:\FRE"
ActiveWorkbook.SaveAs Filename:= _
"G:\FRE\Wrkbk.xls" _
, FileFormat:=xlNormal, Password:="",
WriteResPassword:="orange", _
ReadOnlyRecommended:=False, CreateBackup:=True

However, I get a debug error that says: "Operation
failed. 'G:\WIL\Wrkbk.xls' is write reserved.', because
the previous file that is being replaced is write
protected, and I don't want it to be removed.

Is there a code I can use to automatically enter the
password to modify, then replace? Thanks for the help.

Kate
 
G

Guest

hi,
you already have the code.
in the activeWorkbook.saveas part Password:=""
put your password between the double quotes.
Password:="yourpassword"
:)
 

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
Looping Question 3
Need Help with VBA SaveAs 1
Saving a workbook with a makro 2
Saving a workbook to an iKnow portal 2
create a workbook 1
Save with ref. to cell A1 2
Save As Macro 2

Top