Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect a macro


I've got a workbook that email out to about 50 people each month.
have a "homepage" where I've inserted several Macro buttons an
hyperlinks.

Some of the macros, I only want available to 3 or 4 people. Can I mak
those macros where it prompts you for a password if you try to ru
them?

If so, how do I assign the password?

Thank

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default protect a macro

There isn't any built in way to password protect the execution of a macro --
you have to write the code to prompt for a password. For example,

Sub TheMacro()
If InputBox("Enter a password:") < "the_password" Then
Exit Sub
End If
'
' rest of code
'
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"rbanks" wrote in message
...

I've got a workbook that email out to about 50 people each month. I
have a "homepage" where I've inserted several Macro buttons and
hyperlinks.

Some of the macros, I only want available to 3 or 4 people. Can I make
those macros where it prompts you for a password if you try to run
them?

If so, how do I assign the password?

Thanks


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default protect a macro

rbanks

Sub pass()
enterpass = InputBox("Enter Password To Run Macro")
If enterpass < "rbanks" Then GoTo notright
MsgBox "You have got it right"
Exit Sub
notright:
MsgBox "Incorrect Password Try Again"
End Sub

Be sure to set Protection on your VBA Project so's others can't see your macro
password.

Note: there are Password crackers out there that can break the password on
your VBA Project. Excel is not secure from those who would wish to snoop but
you can keep out the casual and not-so-snoopy users.

Gord Dibben XL2002

On Fri, 21 Nov 2003 14:18:52 -0600, rbanks
wrote:


I've got a workbook that email out to about 50 people each month. I
have a "homepage" where I've inserted several Macro buttons and
hyperlinks.

Some of the macros, I only want available to 3 or 4 people. Can I make
those macros where it prompts you for a password if you try to run
them?

If so, how do I assign the password?

Thanks


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


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
Protect macro ST Excel Discussion (Misc queries) 1 June 6th 06 06:26 PM
How to protect my macro Protect & Unprotect Several Worksheets Excel Discussion (Misc queries) 1 January 7th 05 02:01 AM
Protect Macro Coding Paul Moles[_2_] Excel Programming 1 November 8th 03 02:29 PM
protect - macro? Stu[_31_] Excel Programming 13 October 20th 03 01:48 AM
Macro to protect with pword in 97 Wes[_4_] Excel Programming 1 September 15th 03 05:34 PM


All times are GMT +1. The time now is 06:39 PM.

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

About Us

"It's about Microsoft Excel"