Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passwords on macros's
I want to set up a button that runs a macro, but I want the user to be prompted to key in a password so that only certain users can run macro
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passwords on macros's
Kathy, use something like this
Sub Password_To_Run() Dim PW As String PW = Application.InputBox( _ Prompt:="Please Enter The Password", _ Title:="Password Required To Run This Macro", _ Type:=2) If PW = "abc" Then ''The password is CASE sensitive '''*****Your Code Here***** Else '''****If Password Is Incorrect********* MsgBox Prompt:="Sorry, That Is Not The Correct Password", _ Title:="Incorrect Password", _ Buttons:=vbOKOnly End If End Sub -- Paul B Always backup your data before trying something new Using Excel 97 & 2000 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Kathy" wrote in message ... I want to set up a button that runs a macro, but I want the user to be prompted to key in a password so that only certain users can run macro |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passwords on macros's
You must also lock the VBA project so you can't see the password in it
-- Paul B Always backup your data before trying something new Using Excel 97 & 2000 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Paul B" wrote in message ... Kathy, use something like this Sub Password_To_Run() Dim PW As String PW = Application.InputBox( _ Prompt:="Please Enter The Password", _ Title:="Password Required To Run This Macro", _ Type:=2) If PW = "abc" Then ''The password is CASE sensitive '''*****Your Code Here***** Else '''****If Password Is Incorrect********* MsgBox Prompt:="Sorry, That Is Not The Correct Password", _ Title:="Incorrect Password", _ Buttons:=vbOKOnly End If End Sub -- Paul B Always backup your data before trying something new Using Excel 97 & 2000 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Kathy" wrote in message ... I want to set up a button that runs a macro, but I want the user to be prompted to key in a password so that only certain users can run macro |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passwords | Excel Discussion (Misc queries) | |||
Passwords | Excel Discussion (Misc queries) | |||
Passwords | Excel Discussion (Misc queries) | |||
Passwords | Excel Discussion (Misc queries) | |||
changes and passwords | Excel Discussion (Misc queries) |