Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to Password protect the running of a Macro
I have a Macro that I only want certain people to be able to Run, I have created the Macro but before it runs / executes I would like a dialog box to pop up with a required password input, If the password is incorrect the action is just cancelled Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Did a search of Groups and spotted this neat code to do what I require
Sub PasswordForAMacro() Dim Message As String, Title As String Dim MyValue As String Message = "Please enter your password to access this" Title = "Run Macro" MyValue = InputBox(Message, Title, Default) If MyValue < "1234" Then MsgBox "Invalid password - you cannot access this" Exit Sub Else 'type the actions / code you require to run' ActiveSheet.Range("A1").Select End If End Sub "John" wrote in message ... Is it possible to Password protect the running of a Macro I have a Macro that I only want certain people to be able to Run, I have created the Macro but before it runs / executes I would like a dialog box to pop up with a required password input, If the password is incorrect the action is just cancelled Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there an input mask that will enter the Password as **** instead of 1234?
I will be accessing this log on lineso a user in the remote location might see the password I type in "John" wrote in message ... Did a search of Groups and spotted this neat code to do what I require Sub PasswordForAMacro() Dim Message As String, Title As String Dim MyValue As String Message = "Please enter your password to access this" Title = "Run Macro" MyValue = InputBox(Message, Title, Default) If MyValue < "1234" Then MsgBox "Invalid password - you cannot access this" Exit Sub Else 'type the actions / code you require to run' ActiveSheet.Range("A1").Select End If End Sub "John" wrote in message ... Is it possible to Password protect the running of a Macro I have a Macro that I only want certain people to be able to Run, I have created the Macro but before it runs / executes I would like a dialog box to pop up with a required password input, If the password is incorrect the action is just cancelled Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can't do that with an inputbox. You'd need a userform with a
textbox whose PasswordChar property set to "*". -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "John" wrote in message ... Is there an input mask that will enter the Password as **** instead of 1234? I will be accessing this log on lineso a user in the remote location might see the password I type in "John" wrote in message ... Did a search of Groups and spotted this neat code to do what I require Sub PasswordForAMacro() Dim Message As String, Title As String Dim MyValue As String Message = "Please enter your password to access this" Title = "Run Macro" MyValue = InputBox(Message, Title, Default) If MyValue < "1234" Then MsgBox "Invalid password - you cannot access this" Exit Sub Else 'type the actions / code you require to run' ActiveSheet.Range("A1").Select End If End Sub "John" wrote in message ... Is it possible to Password protect the running of a Macro I have a Macro that I only want certain people to be able to Run, I have created the Macro but before it runs / executes I would like a dialog box to pop up with a required password input, If the password is incorrect the action is just cancelled Thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How would one set up the routine to provide a usertform rather than an input
box then? Gazza "Chip Pearson" wrote in message ... You can't do that with an inputbox. You'd need a userform with a textbox whose PasswordChar property set to "*". -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "John" wrote in message ... Is there an input mask that will enter the Password as **** instead of 1234? I will be accessing this log on lineso a user in the remote location might see the password I type in "John" wrote in message ... Did a search of Groups and spotted this neat code to do what I require Sub PasswordForAMacro() Dim Message As String, Title As String Dim MyValue As String Message = "Please enter your password to access this" Title = "Run Macro" MyValue = InputBox(Message, Title, Default) If MyValue < "1234" Then MsgBox "Invalid password - you cannot access this" Exit Sub Else 'type the actions / code you require to run' ActiveSheet.Range("A1").Select End If End Sub "John" wrote in message ... Is it possible to Password protect the running of a Macro I have a Macro that I only want certain people to be able to Run, I have created the Macro but before it runs / executes I would like a dialog box to pop up with a required password input, If the password is incorrect the action is just cancelled Thanks |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The original subroutine would have to read: Sub PasswordForAMacro() Userform1.Show End Sub You would need a userform (called Userform1) with a text box (calle Textbox1 with PasswordChar property set to "*") and a button (calle Button1) to submit the userform. Then put the following code in th userform Sub Button1_Click() If Textbox1.text < "1234" Then MsgBox "Invalid password - you cannot access this" Userform1.Hide Exit Sub Else 'type the actions / code you require to run' Userform1.Hide End I -- r.bell321Posted from - http://www.officehelp.i |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I don't know a way, but I know a workaround Say the password was bob12, at the start of your subroutine you coul have the line If InputBox("Enter password") = "bob12" Then etc.... end if THis would prompt for a password. You would then have to protect you VBAProject to stop people seeing this -- r.bell321Posted from - http://www.officehelp.i |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to allow auto filter after running password protect | Excel Discussion (Misc queries) | |||
Password for Running the Macro | Excel Discussion (Misc queries) | |||
Password Protect Macro? | Excel Programming | |||
Add protect worksheet password in macro | Excel Worksheet Functions | |||
Password protect macro | Excel Programming |