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



Howdie All,

I have a workbook with many macros in, some I use for design, and would
not like users to be able to run them, (which they can currently easily
do by selecting Tools...macro...run...)

So the question is, can I protect some macros from being run?

Regards

D

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Protect a Macro

You can use the Private keyword with your macro to prevent it from
showing in the list of macros, such as

Private Sub Macro1()

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Protect a Macro

Hi Darin,

you can also use useless optional parameter:

Sub macro1(optional useless as variant)

macro1 will not be visible to the user in macrorun, but you will not
have any problems in your code with this useless parameter (maybe you
could have problems with making the sub private).

Regards,
Ivan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Protect a Macro


Darin:
This will prevent the user from accessing the macro from the Tools
menu.

Sub macro1_(Optional_HideRoutine_As_Integer)_

Brian M.


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=540314

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Protect a Macro

If you put

Option Private Module

as the first line of code in your code module, none of the macros
in that module will be listed in the Macro Dialog. If, however,
the user knows the name of the macro, he can type it in the
dialog and get it to run.


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


"Darin Kramer" wrote in message
...


Howdie All,

I have a workbook with many macros in, some I use for design,
and would
not like users to be able to run them, (which they can
currently easily
do by selecting Tools...macro...run...)

So the question is, can I protect some macros from being run?

Regards

D

*** Sent via Developersdex http://www.developersdex.com ***





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Protect a Macro

Thanks all for your feedback!!

Regards

Darin



*** Sent via Developersdex http://www.developersdex.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
protect a macro kwiklearner[_11_] Excel Programming 2 March 30th 06 02:42 PM
Protect Macro Joe Excel Programming 1 August 13th 04 07:19 AM
protect a macro rbanks[_8_] Excel Programming 2 November 21st 03 09:03 PM
protect - macro? Stu[_31_] Excel Programming 13 October 20th 03 01:48 AM


All times are GMT +1. The time now is 02:02 AM.

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"