Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Password on Macro Button
Is it possible to have a macro assigned to a macro button that when the
button is selected it will ask for a password before the macro will run? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Password on Macro Button
How about asking first thing in the macro:
Option Explicit Sub Testme() dim pwd as password 'more declarations 'before you do anything pwd = inputbox(Prompt:="What's the password, Kenny?") if pwd = "topSeCreT" then 'keep going else 'nope, get out exit sub end if 'more code here End sub You may want to protect the project to make it a little more difficult for most people to see the password in your code. Select your project in the VBE Tools|VBAProject|Protection tab Give it a memorable password Note that there are inexpensive project password breakers available. You won't stop all, but you'll stop most. scuba wrote: Is it possible to have a macro assigned to a macro button that when the button is selected it will ask for a password before the macro will run? -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Password on Macro Button
A VERY simple password [password = HELLO] that is VERY unprotected would be...
'/========================================/ Sub MyMacroButton() If SimplePassword(InputBox("Enter Password: ")) Then 'put code here Else Exit Sub End If End Sub '/========================================/ Private Function SimplePassword(strAnswer As String) As Boolean If UCase(strAnswer) = "HELLO" Then SimplePassword = True End If End Function '/========================================/ -- Hope this helps. Thanks in advance for your feedback. Gary Brown "scuba" wrote: Is it possible to have a macro assigned to a macro button that when the button is selected it will ask for a password before the macro will run? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Password on Macro Button
Thank you to both of you for your help. I got it to work.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using Macro to sort without clicking on macro button | Excel Discussion (Misc queries) | |||
password protect the button in Excel? | Excel Discussion (Misc queries) | |||
Password restricted single macro and button | Excel Discussion (Misc queries) | |||
use macro button to run macro in protected sheet | Excel Discussion (Misc queries) | |||
How to see macro code of a password protected macro without a password? | Excel Worksheet Functions |