![]() |
HELP: Update a password protected workbook and save it as unprotec
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 |
HELP: Update a password protected workbook and save it as unprotec
wbk.protect
is like doing Tools|Protection|protect workbook (in xl2003 menus). Try with wbk .password = "" .... sam wrote: 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 -- Dave Peterson |
HELP: Update a password protected workbook and save it as unprotec
sam,
see if this helps ..SaveAs Filename:=FPath, _ FileFormat:=xlNormal, _ Password:="", _ WriteResPassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False -- jb "sam" wrote: 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 |
All times are GMT +1. The time now is 04:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com