LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default problem changing password

I'm writing a macro to change the passwords on some of the spreadsheets
in a workbook. For now, the ones with "Monthly" in the sheet name. The
code brings up a userform which asks for the old password, then for the
new password to be entered twice. The program compares the 2 entries to
verify, then is supposed to change all the passwords for the "monthly"
sheets. It works fine finding only the "monthly" sheets, then hangs on
the first sheet with the old password line highlighted and an error
message that the old password is incorrect. When I put the cursor over
the old password, variable sPWORD1, the correct old password is shown.

For Each ws In ActiveWorkbook.Worksheets
If ws.Name Like "*Monthly" Then
ActiveSheet.Unprotect Password:=sPWORD1 <---- Password not
correct
ActiveSheet.Protect Password:=sPWORD2
End If

Next

Any ideas on what I'm missing?

Thanks.

 
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
changing password Charlie Brown Excel Discussion (Misc queries) 3 June 7th 07 12:11 PM
changing password to **** praveen_khm[_41_] Excel Programming 4 April 20th 06 06:38 PM
Restrict users from changing password roel1973 Excel Discussion (Misc queries) 3 April 12th 06 05:10 PM
Changing password protection on sheets Tom Hewitt Excel Discussion (Misc queries) 5 February 25th 05 03:33 PM
Changing a made up password Nornny Excel Programming 1 June 4th 04 05:01 PM


All times are GMT +1. The time now is 07:05 AM.

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"