• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

How to protect macros from viewing and editiing

I have lot of macros for my daily work in word.
I have made a SUB and within this I have put all other macros with Call procedure which are kept under Private Sub.
Now since the macro has to be run on various computers. I want:
1. Main sub should be visible and the Call procedures can be made able or disable.
2. All the Private sub under refrence of Call from main sub should be pasword protected and NOT VISIABLE OR EDITABLE OR IT SHOULD NOT EVEN HAVE A SAVE/EXPORT OPTION.
Is there any way to have this?
Thanks in advance for cooperation.
2 Solutions
open word, then go to the Visual Basic Editor. In the projecdt explorer, right click on the Projecdt entry, select Properties,  then select the Protection tab.  There you can add a Password to the project, so that if anyone attempts to open then project in the Visual Basic Editor, they must first provide the password.

micazoneAuthor Commented:
This will protect the entire project.
I want Main sub to be visible and editable to all. Only the oprivate subs to be protected. Is there any way.
I don't think you can do it. Except you have write your own dll and call from you function
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

try right clicking on each of the modules that hold the macros that you want to protect., and set the password at the module level - you will need to group your macros into separate modules, as the Password is MODULE level, not Macroi level.  

By locking these with a password, you may find that the end user cannot run them without the password.

Just a thought...

actually, that is not the case.  The password only block editting the Macro, not executing it.

I have protected many apps this way, and users know nothing about the password protection.  What use would the password be if the user needed to know the password to execute the macro?  That same user could then also edit the macro...and the point of the password would be lost.

micazoneAuthor Commented:
No it does not work.
Can you suggest a way to make a user form with check boxes for each macro. The macro module can be protected as suggested by you and let the user form be added to the tool bar and run from there.
micazoneAuthor Commented:
I have solved the problem.
1. I created user form with severeal check boxes for each macro.
2. one sub for show the form.
3. Protected the code with pass word.
This siolved my problem
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now