• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Customize Display Warning

Areif

Member
Hi Expert !!

if any one tried to unlock the protect sheet with wrong password by default Microsoft message display , that message we can customize as per our need or any other way we can display message we want.
Thanks in advanced.
 
Don't think there's VBA method that can accomplish it.

Instead you need a simple code to use InputBox for users to enter password.

Something like below.
Code:
Sub UnprotectSheets()
Dim pwd As String
On Error GoTo ErrorHandler
pwd = InputBox("Please Enter Your Password")
If pwd = "" Then Exit Sub
ActiveSheet.Unprotect pwd

ErrorHandler:
    MsgBox "Your Message Here"

End Sub

However, users are still able to use ribbon to unprotect sheet. To disable that... it's bit more complex and depends on your Excel version. If 2007 or later you will need to work with XML. Following link is an excellent resource on ribbon customization.

http://www.rondebruin.nl/win/section2.htm
 
Back
Top