Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passwords Tina Marie Excel Discussion (Misc queries) 2 March 17th 08 04:21 PM
Passwords Lillian[_2_] Excel Discussion (Misc queries) 6 July 30th 07 01:32 PM
Passwords Cathi Excel Discussion (Misc queries) 1 October 13th 06 06:01 PM
Passwords dhightow Excel Discussion (Misc queries) 0 April 24th 06 08:22 PM
changes and passwords Ciara Excel Discussion (Misc queries) 7 May 20th 05 01:32 PM


All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"