![]() |
Macros & passwords
Hi
I need to create a password protected macro. By this I don't mean the code (already done) but the ability to launch the macro itself. I am sending a spreadsheet out and it has several macros inbeded. I got one macro that I am the only one to use and needs to be protected against others launching it. Any Ideas? |
Macros & passwords
Chris, here is one way,
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 2002 & 2003 "Chris" wrote in message ... Hi I need to create a password protected macro. By this I don't mean the code (already done) but the ability to launch the macro itself. I am sending a spreadsheet out and it has several macros inbeded. I got one macro that I am the only one to use and needs to be protected against others launching it. Any Ideas? |
Macros & passwords
Perfect, exactly what I needed!
Thanks "Paul B" wrote: Chris, here is one way, 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 2002 & 2003 "Chris" wrote in message ... Hi I need to create a password protected macro. By this I don't mean the code (already done) but the ability to launch the macro itself. I am sending a spreadsheet out and it has several macros inbeded. I got one macro that I am the only one to use and needs to be protected against others launching it. Any Ideas? |
Macros & passwords
Your welcome, thanks for the feedback
-- 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 "Chris" wrote in message ... Perfect, exactly what I needed! Thanks "Paul B" wrote: Chris, here is one way, 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 2002 & 2003 "Chris" wrote in message ... Hi I need to create a password protected macro. By this I don't mean the code (already done) but the ability to launch the macro itself. I am sending a spreadsheet out and it has several macros inbeded. I got one macro that I am the only one to use and needs to be protected against others launching it. Any Ideas? |
All times are GMT +1. The time now is 10:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com