ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "Protecting" VBA macro from source reading... (https://www.excelbanter.com/excel-programming/401665-protecting-vba-macro-source-reading.html)

Kedar Agarkar

"Protecting" VBA macro from source reading...
 
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

carlo

"Protecting" VBA macro from source reading...
 
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

On Nov 26, 5:08 pm, Kedar Agarkar wrote:
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



Chip Pearson

"Protecting" VBA macro from source reading...
 
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/Creati...nctionLib.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)



"Kedar Agarkar" wrote in message
...
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



Kedar Agarkar

"Protecting" VBA macro from source reading...
 
Chip and Carlo, thanks much about your very useful elaboration.

Shall be certainly of help to me.

Thanks both for your time.

- Kedar

On Nov 26, 6:47 pm, "Chip Pearson" wrote:
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. Seehttp://www.cpearson.com/Excel/CreatingCOMAddIn.aspxandhttp://www.cpearson.com/Excel/AutomationAddIns.aspxandhttp://www.cpearson.com/Excel/CreatingNETFunctionLib.aspxfor 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 Consultingwww.cpearson.com
(email on the web site)

"KedarAgarkar" wrote in message

...



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- Hide quoted text -


- Show quoted text -



Jon Peltier

"Protecting" VBA macro from source reading...
 
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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Chip Pearson" wrote in message
...
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/Creati...nctionLib.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)



"Kedar Agarkar" wrote in message
...
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






All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com