ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Attach password to Button? (https://www.excelbanter.com/excel-programming/375239-attach-password-button.html)

mike

Attach password to Button?
 
Seems like the simplest thing to do, but I can't find the first Google
result. I think all the results about protection are clogging up any
that might help me. I just want the user to be prompted for a password
before a certain macro runs.

Any suggestions welcome.


Zone

Attach password to Button?
 
Mike, Try something like:
Sub MyMacro()
Dim pw as String
pw=inputbox("Enter password")
Select Case pw
Case "abcd","wxyz"
'execute your macro code
Case else
Msgbox "Invalid password"
Exit Sub
End Select
End Sub
James
mike wrote:
Seems like the simplest thing to do, but I can't find the first Google
result. I think all the results about protection are clogging up any
that might help me. I just want the user to be prompted for a password
before a certain macro runs.

Any suggestions welcome.



mike

Attach password to Button?
 
Slick. Thanks.

On Oct 16, 3:35 pm, "Zone" wrote:
Mike, Try something like:
Sub MyMacro()
Dim pw as String
pw=inputbox("Enter password")
Select Case pw
Case "abcd","wxyz"
'execute your macro code
Case else
Msgbox "Invalid password"
Exit Sub
End Select
End Sub
James



mike wrote:
Seems like the simplest thing to do, but I can't find the first Google
result. I think all the results about protection are clogging up any
that might help me. I just want the user to be prompted for a password
before a certain macro runs.


Any suggestions welcome.- Hide quoted text -- Show quoted text -




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

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