Wrong password - Why?

  • Thread starter Thread starter John Curio
  • Start date Start date
J

John Curio

Hi

Why does this code give me the wrong password?
The msgbox says "105" instead of "124".
And the crazy thing is, that Excel unprotect the password with 105.
Can somebody explain me that phenomena?

Sub Passwort()
Dim i As Integer
ActiveSheet.Protect Password:=124
On Error Resume Next
For i = 1 To 110
ActiveSheet.Unprotect Password:=i
If ActiveSheet.ProtectContents = False Then
MsgBox "The Password is: " & i
Exit For
End If
Next i
End Sub

Thank's
John
 
Hi Harlan,
thanks a lot for that link. That's what I was looking for.
john
 

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

Back
Top