(I'm not a VBA pro, more of an enhusiastic amateur)
Is it possible to better protect a VBA project?
I wrote a simple trading sheet for a guy recently
and I put a bit of code in to disable the sheet after
a day or two until he paid me.
What he did though was ask about on a few forums
and got info on how to easily crack a VBA project security.
I tried it and it was alarmingy easy.
He got hold of a Hex editor and created a VBA project with
an easily recognisable password, say DOGBONE for example.
He then found where excel stored this password via the
hex editor, opened my sheet and with the hex editor replaced
my password with the simple one.
Lo and behold he had cracked my VBA project security in about
5 minutes.
Is there a better more secure way to protect a VBA project?
Ron
> Is there a better more secure way to protect a VBA project?
Yes there is (misplaced the link to this one):
1. Save the Excel workbook (.xls) file into an add-in (File > SaveAs.....)
2. After you have the saved add-in (.xla), close the Excel workbook (.xls)
3. Double click on the add-in to open it
4. Press Alt+F11 to access the add-in's vba project
5. Lock the vba-project with a password
6. Double-click on the "ThisWorkbook" code module
7. Press F4 to open the Properties window
8. Change the "IsAddin" status to FALSE
9. Return to Excel by Pressing Alt+Q (or close the vbe window)
10. Go to Tools > Share Workbook
11. When the dialogue appears, check the box for: (Allow changes by.....)
12. Press OK to close the Dialogue
13. When prompted to save, Press OK
14. Press Ok to accept that "macros cannot be accessed"
15. You should feel giddy at this point because you just realized what you have
been missing right under your nose
16. Verify that the [SHARED] appears in the application title bar
17. Now save the workbook again as an Add-in (File > SaveAs...) overwriting the
previous one
18. Close this Excel workbook without saving the changes (you don't need it)
19. Test out your newly saved add-in (open it, access the vbe, try to expand
the project window, you should get the new message "Project is Unviewable"
20. Your done
Regards,
Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com
It never ceases to amaze me how many good people are hanging around this
place with rapid response answers.
Thanks again, I will try it out.
Ron
Jan, my spreadsheet uses XML data, so when I follow this procedure I
get an error at step 10 saying "This workbook cannot be shared because
it contains Excel tables or XML maps...". Is there any way of
protecting my VBA?
> Jan, my spreadsheet uses XML data, so when I follow this procedure I
> get an error at step 10 saying "This workbook cannot be shared because
> it contains Excel tables or XML maps...". Is there any way of
> protecting my VBA?
Looks like you can't, I'm sorry!
Regards,
Jan Karel Pieterse