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

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
 
D

Dave Peterson

wbk.protect

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

Try

with wbk
.password = ""
....
 
J

john

sam,
see if this helps

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

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

Top