Sub ProtectVBProject(Pwd As String)
Dim vbProj As Object
Set vbProj = Application.VBE.ActiveVBProject
If vbProj.Protection = 1 Then Exit Sub ' already protected
Set Application.VBE.ActiveVBProject = vbProj
SendKeys "%TE+{TAB}{RIGHT}%V%P" & Pwd & "%C" & Pwd & "{TAB}{ENTER}"
End Sub
You’re welcome but don’t rely on it for security. It only takes a couple of seconds to bypass the password if you know how.Thanks a lot. Worked like charm
Yes I know how. But I do it along with other security measures like hiding navpane, setting allowbyoas to false, converting to accde and encrypting it.You’re welcome but don’t rely on it for security. It only takes a couple of seconds to bypass the password if you know how.
I thought it might make it more secure. Can we see module names in accde?If you convert to ACCDE, the code is unviewable so no point in setting the VB project password in that case
When VBA project is password protected, modules amd procedures are not visible until password is entered or password is removed by any method. I am concered about keeping safe my app from being cracked and data as well. I am isong BE encrypted with password.
Hello again,Yes its possible though somewhat pointless as its very easy to bypass the VB project password.
If you really want to do this, then AFAIAA you have to use SendKeys to set the password.
Code:Sub ProtectVBProject(Pwd As String) Dim vbProj As Object Set vbProj = Application.VBE.ActiveVBProject If vbProj.Protection = 1 Then Exit Sub ' already protected Set Application.VBE.ActiveVBProject = vbProj SendKeys "%TE+{TAB}{RIGHT}%V%P" & Pwd & "%C" & Pwd & "{TAB}{ENTER}" End Sub
Typical usage:
ProtectVBProject "ABC"
You need to close & reopen (or compact the database) for this to take effect
Sorry but I checked before my last reply. You are incorrect.
I can get a complete list of modules & procedures from an encrypted database with a VBA password without entering (or even knowing the VBA password).
No trickery. No clever code. Its visible to all
Yes you can as I stated in post #10I don't think you can get a list of the procedures within the modules can you?
You could just rename the modules, mod1, mod2, mod3 etc to obfuscate what they do.
I doubt it but I've never had a reason to try and I never use SendKeys myself.Hello again,
Can I use this method to perform the same operation on VBE project in other db? I could find a way to set active VB project to other db VB project.
Best Regards
Option Private Module
are not visible either.