Passwords on a checkbox?

AJSatori

Board Regular
Joined
Jul 11, 2002
Messages
62
Is it possible to place a password on a checkbox in VBA? If so ...How?
Please help
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

KniteMare

Board Regular
Joined
Mar 4, 2002
Messages
238
You can put a "Password" on anything. What a password really is is a comparison of two strings.
I do this all the time.
I set up the action the user takes, say check the box, to trigger an input box requesting the "Password" This becomes a variable , say stringA. This is compared to a constant in the Code, Say String B. If A matches B they go On to do the task, Else. ACESS DENIED>
'Like this:

Dim TheWord As String
TheWord = "YourPW"
If InputBox("What's the word Dude?", "Password Required") = TheWord Then
MsgBox "yourIn!"
'Your Code Here
Else
MsgBox "Access Denied"
End If


Yours in EXCELent Frustration

KniteMare


In my mind I am already on Vacation. With an option to retire.
This message was edited by KniteMare on 2002-08-29 05:58
 

AJSatori

Board Regular
Joined
Jul 11, 2002
Messages
62
I understand the concept of the password but I just could not get it to work. what action for the checkbox should I use, click, change, mouseup? Do I use an input box or a textbox? I have tried alot of different things but it just wont go for me. When I do get it to work you can still check the box if you don't get the PW right.
This message was edited by AJSatori on 2002-08-29 06:05
 

KniteMare

Board Regular
Joined
Mar 4, 2002
Messages
238
Try this it is closer.

Goes in the code for the affected sheet.


Private Sub CheckBox1_Click()
Dim TheWord As String
TheWord = "YourPW"
If InputBox("What's the word Dude?", "Password Required") = TheWord Then
MsgBox "yourIn!"
'Your Code Here
Else
MsgBox "Access Denied"
CheckBox1.Value = 0


End If


End Sub


I gotta run now. The check box is not a tool I use so your question has got me thinking about it's properties. That is the beauty of this forum, it gets you looking into areas you have not explored.

Yours in EXCELent Frustration

KniteMare
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,824
Messages
5,766,657
Members
425,367
Latest member
Boboka

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top