Is there a good way to make vba code secure other than using a password, which I understand is quite easy to break?

Q1) Are we talking MS Access? If Excel or Word the its a different ball game

Q2) I assume you are talking about distributing the Db. If so then compile it to
a mde and the code cant be seen or altered. If you cant distribute as mde's then
there are many ways to protect your code/db but I'd need to know more on the
environment and set up ie vba code and forms in one db with seperate back end etc
or all in one Db.

The above makes for different answers, I've got various bits of code to lock down a MS Access Db (mdb)
so depending on what you want to do I my be able to help.

Graham aka (Lastpilgrim)

Edited 6 Years Ago by lastpilgrim: n/a

Hi Lastpilgrim,
Thanks for the rapid response. The VBA app I want to protect is not for Excel, Word or Access, it is for a CAD program called ZWCAD (virtually identical to AutoCAD). It has an embedded integrated development environment (IDE) that uses VBA 6. It creates VBA forms, modules and classes that interact with CAD drawings.
Do you have any bits of code that could help?

Regards
Graham

Hi Graham,

Cant really offer any code as all the code I have is very Ms Access specific !

What I can do is suggest some posible ideas that you could try.

The way we tackled the problem was to have a routine which ran on start up (Autoexec)
that first checked to see if a particular file existed on the PC though it could have been a registry value if it exists then the file was allowed to open in normal (Developer) mode.

if not developer then all menus, command bars etc were disabled and replaced with custom ones for the user only.

We also disabled the close button so we had to force the user to exit via our close method and hence with access restored all the menus back to normal!

Dont know if this helps and if its posible to do such things in your program, it just a lot of trolling through help file and the internet thats how we did it but then there is more out there fo Ms Access i guess than your CAd Program.

Sorry to not be more help

Graham
(AKA Lastpilgrm)


Hi Lastpilgrim,
Thanks for the rapid response. The VBA app I want to protect is not for Excel, Word or Access, it is for a CAD program called ZWCAD (virtually identical to AutoCAD). It has an embedded integrated development environment (IDE) that uses VBA 6. It creates VBA forms, modules and classes that interact with CAD drawings.
Do you have any bits of code that could help?

Regards
Graham

Hi Graham,
Thanks for the ideas, I'll keep looking for a solution. Hopefully someone who has AutoCAD VBA experience may have a solution.

This article has been dead for over six months. Start a new discussion instead.