how to enable & disable customised button on toolbar

M

mango

dear all,
infact i posted but no solution yet.
i 1 2 let authorised user only to use the customised button. if the user
provide correct password then the button is enabled else disabled.
how to code the enable or visible true/false in the script?

pls advise. thanks
 
J

JE McGimpsey

one way:

Assuming the button is named "MyButton" on the toolbar "MyBar":

Public Sub EnableButton()
Const sPWORD As String = "drowssap"
Dim vResult As Variant
Do
vResult = Application.InputBox( _
Prompt:="Password:", _
Title:="Input Password", _
Type:=2)
If vResult = False Then Exit Sub 'User cancelled
Loop Until Len(vResult) > 0
CommandBars("MyBar").Controls("MyButton").Enabled = _
vResult = sPWORD

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top