"Protecting" VBA macro from source reading...

  • Thread starter Thread starter Kedar Agarkar
  • Start date Start date
K

Kedar Agarkar

Hi,

Is there any way to protect VBA macro from source code reading and
modification? Is only way to do is to wrap as COM object?

Thanks for your time.

- KA
 
When you are in the VB-Editor, go to tools --> VBA project properties
and there you have a Tab security where you can enter a password.
How secure this is...don't ask me, but you sure can find some infos
about that on google.

hth

Carlo
 
In the VBA Editor, choose VBA Project Properties, then the Protection tab.
There, check "Lock project for viewing", enter a password (twice) and then
save the workbook. Note that this level of security is notoriously weak.
There are many password breakers readily available on the net. I use VBAKey
from Passware (about $40) and it can crack any VBA project password in a
matter of seconds. (As an aside, VBAKey doesn't necessarily return the
actual password used on the project. Instead, it finds a password that will
unlock the project, which is not necessarily the actual password used.)

You should think of VBA protection as a mechanism to prevent the honest user
from making honest mistakes. It should not be used to protect proprietary
data or code with intellectual property value. If you really need to lock
down the code, you should write a COM Add-In or an Automation Add-In in VB6
or NET. See http://www.cpearson.com/Excel/CreatingCOMAddIn.aspx and
http://www.cpearson.com/Excel/AutomationAddIns.aspx and
http://www.cpearson.com/Excel/CreatingNETFunctionLib.aspx for example code.
With these types of add-ins, no source code is ever distributed to the
user -- only compiled machine code or MSIL is distributed to the end user--
so you don't have to worry about users viewing and/or modifying code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
Chip and Carlo, thanks much about your very useful elaboration.

Shall be certainly of help to me.

Thanks both for your time.

- Kedar
 
While this kind of protection is notoriously insecure, I find it is pretty
effective. When I tell a client that the project is password protected, they
just assume I'm all-powerful and don't even seem to consider that it can be
bypassed. (I usually send an unlocked version after they pay my invoice.)

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top