protecting a macro button
I have a spreadsheet set up with a few macro buttons and I was looking for a
way to protect those buttons so that only certain users would be able to push them. Is there any way to do this? Thanks so much!!! |
protecting a macro button
mydogpeanut, you could ask for a password to run the macro, something like
this Sub PassWord_To_Run_Macro() '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 2002 & 2003 "mydogpeanut" wrote in message ... I have a spreadsheet set up with a few macro buttons and I was looking for a way to protect those buttons so that only certain users would be able to push them. Is there any way to do this? Thanks so much!!! |
protecting a macro button
Paul can't thank you enough!! This worked GREAT!!!!!
thanks again!!! "Paul B" wrote: mydogpeanut, you could ask for a password to run the macro, something like this Sub PassWord_To_Run_Macro() '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 2002 & 2003 "mydogpeanut" wrote in message ... I have a spreadsheet set up with a few macro buttons and I was looking for a way to protect those buttons so that only certain users would be able to push them. Is there any way to do this? Thanks so much!!! |
protecting a macro button
Your welcome
-- 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 2002 & 2003 "mydogpeanut" wrote in message ... Paul can't thank you enough!! This worked GREAT!!!!! thanks again!!! "Paul B" wrote: mydogpeanut, you could ask for a password to run the macro, something like this Sub PassWord_To_Run_Macro() '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 2002 & 2003 "mydogpeanut" wrote in message ... I have a spreadsheet set up with a few macro buttons and I was looking for a way to protect those buttons so that only certain users would be able to push them. Is there any way to do this? Thanks so much!!! |
protecting a macro button
Anthoer Question...
How do I hide the password in the Macro? So if someone is looking or trying to look at the macro they do not see the password? Also is there anyway that when the box pops up asking for the password to make it so the password doesn't show while typing it in? Thanks so much for any and all help "Paul B" wrote: Your welcome -- 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 2002 & 2003 "mydogpeanut" wrote in message ... Paul can't thank you enough!! This worked GREAT!!!!! thanks again!!! "Paul B" wrote: mydogpeanut, you could ask for a password to run the macro, something like this Sub PassWord_To_Run_Macro() '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 2002 & 2003 "mydogpeanut" wrote in message ... I have a spreadsheet set up with a few macro buttons and I was looking for a way to protect those buttons so that only certain users would be able to push them. Is there any way to do this? Thanks so much!!! |
protecting a macro button
This was commented in the macro "'must lock VBA project so you can't see the
password in it" To protect the VBA project, from your workbook right-click the workbook's icon and pick View Code. This icon is at the top-left of the spreadsheet this will open the VBA editor, in Project Explorer right click on your workbook name, if you don't see it press CTRL + r to open the Project Explorer then select VBA project properties, protection, check lock project for viewing and set a password. Press Alt and Q to close this window and go back to your workbook and save and close the file. Be aware that this password can be broken by third party software. If you don't want to see what is entered in the box you will have to create a userform with a textbox on it and set the PasswordChar property to * and a button to validate the password that was put in, more work but it can be done. "mydogpeanut" wrote in message ... Anthoer Question... How do I hide the password in the Macro? So if someone is looking or trying to look at the macro they do not see the password? Also is there anyway that when the box pops up asking for the password to make it so the password doesn't show while typing it in? Thanks so much for any and all help "Paul B" wrote: Your welcome -- 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 2002 & 2003 "mydogpeanut" wrote in message ... Paul can't thank you enough!! This worked GREAT!!!!! thanks again!!! "Paul B" wrote: mydogpeanut, you could ask for a password to run the macro, something like this Sub PassWord_To_Run_Macro() '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 2002 & 2003 "mydogpeanut" wrote in message ... I have a spreadsheet set up with a few macro buttons and I was looking for a way to protect those buttons so that only certain users would be able to push them. Is there any way to do this? Thanks so much!!! |
protecting a macro button
Paul my hero once again.
Thanks so much! "Paul B" wrote: This was commented in the macro "'must lock VBA project so you can't see the password in it" To protect the VBA project, from your workbook right-click the workbook's icon and pick View Code. This icon is at the top-left of the spreadsheet this will open the VBA editor, in Project Explorer right click on your workbook name, if you don't see it press CTRL + r to open the Project Explorer then select VBA project properties, protection, check lock project for viewing and set a password. Press Alt and Q to close this window and go back to your workbook and save and close the file. Be aware that this password can be broken by third party software. If you don't want to see what is entered in the box you will have to create a userform with a textbox on it and set the PasswordChar property to * and a button to validate the password that was put in, more work but it can be done. "mydogpeanut" wrote in message ... Anthoer Question... How do I hide the password in the Macro? So if someone is looking or trying to look at the macro they do not see the password? Also is there anyway that when the box pops up asking for the password to make it so the password doesn't show while typing it in? Thanks so much for any and all help "Paul B" wrote: Your welcome -- 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 2002 & 2003 "mydogpeanut" wrote in message ... Paul can't thank you enough!! This worked GREAT!!!!! thanks again!!! "Paul B" wrote: mydogpeanut, you could ask for a password to run the macro, something like this Sub PassWord_To_Run_Macro() '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 2002 & 2003 "mydogpeanut" wrote in message ... I have a spreadsheet set up with a few macro buttons and I was looking for a way to protect those buttons so that only certain users would be able to push them. Is there any way to do this? Thanks so much!!! |
All times are GMT +1. The time now is 03:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com