HELP: Update a password protected workbook and save it as unprotec

  • Thread starter Thread starter sam
  • Start date Start date
S

sam

Hi All,

I have a protected workbook which is updated through a userform and then
saved at a different location, I have everything working but one thing.. When
I save it again at a different location I want it to be unprotected, Here is
the piece of code I have to do that, but the workbook is still protected.
please help!

Set wbk = Workbooks.Open("C:\Documents\My_Sheet.xlsm", False, False, ,
"password")

FPath = "C:\Documents\My_Sheet\" & "New_Sheet" & "-" & ".xlsm"

'Code to populate the worksheet goes here


With wbk

..Unprotect "password"
..SaveAs FPath
..Close True

End With
 
wbk.protect

is like doing Tools|Protection|protect workbook (in xl2003 menus).

Try

with wbk
.password = ""
....
 
sam,
see if this helps

..SaveAs Filename:=FPath, _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
 
Back
Top