Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I save a password protected .xlsm file containing old macro Dennis Chou Excel Programming 1 July 27th 09 10:43 PM
update links to password protected workbooks. pjbur2005 via OfficeKB.com Excel Discussion (Misc queries) 1 May 5th 09 12:35 PM
How do I save a password protected Excel doc in order to open? Stamperfiend Excel Discussion (Misc queries) 4 August 25th 05 11:56 PM
bypass password when update linking of password protected file Yan Excel Discussion (Misc queries) 1 February 7th 05 11:29 PM
Open a password protected excel workbook from second workbook to fetch data using dynamic connection kaustav choudhury Excel Programming 2 April 3rd 04 06:18 AM


All times are GMT +1. The time now is 03:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"