#1   Report Post  
Posted to microsoft.public.excel.misc
Chris
 
Posts: n/a
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Paul B
 
Posts: n/a
Default 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?



  #3   Report Post  
Posted to microsoft.public.excel.misc
Chris
 
Posts: n/a
Default 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?




  #4   Report Post  
Posted to microsoft.public.excel.misc
Paul B
 
Posts: n/a
Default 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?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I run excel 4.0 macros on excel 2000 RodolfoDallas Excel Discussion (Misc queries) 1 March 12th 06 03:14 AM
Macros & Passwords paulrm906 Excel Discussion (Misc queries) 2 March 4th 06 07:21 AM
Macros, Protected Books & Missing Passwords jamesanddavid Excel Worksheet Functions 1 April 15th 05 05:45 PM
Enabling macros Peter M Excel Discussion (Misc queries) 3 February 7th 05 10:57 PM
Transferring toolbars and macros to other computers Darrell Excel Discussion (Misc queries) 1 January 19th 05 12:21 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"