Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking the Value of a Password 1

Status
Not open for further replies.

rschneeg

IS-IT--Management
Nov 3, 2004
15
US
I've protected an excel sheet with a password. I know the old value and have successfully unprotected it to run some macro on the form.

I now want to be able to change the password in vb from the old value to the new.

How do I check the value of the current password to see if it's the old one or the new one?

I know how to protect and unprotect using the ActiveSheet. Protect.Password but do not know how to do an IF statement to see which one it is.

thanks
 
Hi,

You can't. Otherwise it would be a trivial matter to crack a password.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Gerry, with sheet protection in Excel 2003 - this works for me
Code:
Sub Macro2()
On Error Resume Next
    ActiveSheet.Unprotect Password:="test2"
    ActiveSheet.Unprotect Password:="test"
End Sub

Gavin
 
Thanks to all who replied.
The ON ERROR works perfectly.
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top