This code here does what I do believe you are looking for it to do. It
is a little ugly using errors to test for the password but it works.
Sub CheckProtection()
If Sheet1.ProtectContents = True Then
MsgBox "I am protected!"
On Error GoTo MustBePassword
Sheet1.Unprotect "ZFNUefnisudr7tqw6etr90er" ''Password that
no one would ever use.
Sheet1.Protect ''Used to protect sheet back up if no
password protecting it.
On Error GoTo 0
Else
MsgBox "I am not protected!"
End If
AllDone:
Exit Sub
MustBePassword:
MsgBox "I am also Password Protected!!"
GoTo AllDone
End Sub
Hope that helps,
Keith
www.kjtfs.com
---
Message posted from
http://www.ExcelForum.com/