User form- protection and password.
Thank you,Norman Jones,Its working !!!
"Norman Jones" wrote:
Hi Tungana,
I misunderstood; I assumed that you wished
to prevent access to the Userform module.
Try assigning something like the following
code to your rectangle:
'==========
Sub Rectangle1_Click()
Dim Res As String
Const PWORD As String = "ABC" '<<==== CHANGE
Res = InputBox(Prompt:="Enter password")
If Res < PWORD Then
MsgBox Prompt:="The password has not " _
& "been recognised!", _
Buttons:=vbCritical, _
Title:="Password"
Exit Sub
End If
'Your code to open theUserform, e.g.:
Userform1 , Show
End Sub
'<<==========
---
Regards.
Norman
"TUNGANA KURMA RAJU" wrote in
message ...
I follwed your instruction ,the user form is still opening after clicking
the
Rectangle to which I assignined the user form code
"Norman Jones" wrote:
Hi Tungana,
===========
How to protect a userform (code + object) by assigning a
password?===========
Try password protecting the VBA project:
In the VBE,
Menus | Tools | VBAProject Properties | Protection |
Lock Project for viewing [x] |
Enter and confirm Password | OK
Save, close and re-open the file.
---
Regards.
Norman
|