-
Solved: Password Protecting - Command Buttons
Hello All !
My workbook is totally controlled by the user selecting one of several Command Buttons on the Front Page for a particular task. From that point they will be able to recieve, select and enter data that followup Userforms allow them to.
However, I need to allow some of the data to be updated but do not want this ability to permitted by all.
How may I "Password Protect" a single Command Button on the Front Page to allow permitted users to update / change data ?
Thank you for you help.
-
Hi there,
Presuming you are using activex controls, you could insist that a password is entered into a textbox before the button really does anything.
For instance, with a button and textbox both default named:
In the Worksheet's Module:
[VBA]
Option Explicit
Private Sub CommandButton1_Click()
If Me.TextBox1.Value = "My Password" Then
MsgBox "Call the userform or whatever...", 0, vbNullString
Me.TextBox1.Value = vbNullString
End If
End Sub
[/VBA]
Hope that helps,
Mark
PS - use the textbox's PasswordChar property to obscure the password entered.
-
Thank you Mark ! That was PERFECT !!!!
-
I was so excited I hit the send button before I meant to.
I made a little change... modified the operation of the command as noted.
which gets rid of the Click.
[VBA]Option Explicit
Private Sub Passwordform_Change()
If Me.Passwordform.Value = "12345678" Then
MsgBox "You Have Permission to Enter", 0, vbNullString
Me.Passwordform.Value = vbNullString
Unload Me
UpdateVendorForm.Show
End If
End Sub[/VBA]
Love it ! Thanks Again !
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules