ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   password on macros (https://www.excelbanter.com/excel-programming/315283-password-macros.html)

justaguyfromky

password on macros
 
How can I put a password on a macro button?

Paul B[_6_]

password on macros
 
Just, some thing like this

Sub PassWord_To_Run()
'must lock VBA project so you can't see the password in it
Dim MyStr1 As String, MyStr2 As String
With ActiveSheet
MyStr2 = ("123") 'This is the password and it is CASE sensitive
MyStr1 = InputBox("Password Is Required To Run this Macro ")
If MyStr1 = MyStr2 Then

'your code here

Else
MsgBox ("Access Denied")
End If
End With
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **
"justaguyfromky" wrote in message
...
How can I put a password on a macro button?




Tom Ogilvy

password on macros
 
In the macro itself, write the code to prompt for the password and to
validate and react to the response.

--
Regards,
Tom Ogilvy


"justaguyfromky" wrote in message
...
How can I put a password on a macro button?





All times are GMT +1. The time now is 03:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com