ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need to set up Macro to save/replace existing doc with password (https://www.excelbanter.com/excel-programming/309505-need-set-up-macro-save-replace-existing-doc-password.html)

kate

Need to set up Macro to save/replace existing doc with password
 
Hello,

I have a macro that is built to 1)update a report daily,
then 2)save it to two different files (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


All times are GMT +1. The time now is 09:11 PM.

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