Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Better protection for VBA project?

5,010 views
Skip to first unread message

Ron

unread,
Jan 17, 2010, 12:33:51 PM1/17/10
to
Hi All,

(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

Jan Karel Pieterse

unread,
Jan 17, 2010, 12:50:40 PM1/17/10
to
Hi 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

Ron

unread,
Jan 17, 2010, 1:10:54 PM1/17/10
to
Thanks,

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

brendanh

unread,
Feb 18, 2010, 6:51:19 PM2/18/10
to
On Jan 17, 5:50 pm, Jan Karel Pieterse <jkpiete...@netscape.net>
wrote:

> Hi Ron,
>
> > Is there a better more secure way toprotectaVBAproject?
>
> Yes there is (misplaced the link to this one):
...

> 10. Go to Tools > Share Workbook
...

> 14. Press Ok to accept that "macros cannot be accessed"
> Regards,
>
> Jan Karel Pieterse
> Excel MVPhttp://www.jkp-ads.com

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 Karel Pieterse

unread,
Feb 22, 2010, 10:31:35 AM2/22/10
to
Hi Brendanh,

> 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

JA

unread,
Apr 8, 2010, 3:42:01 PM4/8/10
to
I got this to work once. Later when I updated the file, I got a message that
this was not a valid add-in? Thoughts? Thanks!

carl...@gmail.com

unread,
Feb 6, 2015, 6:53:01 AM2/6/15
to
Hi Karel

Does it works also with office 2010,
becouse I follow all the steps but it does't work :-(

Thank you in advanced
Carlo

prof...@gmail.com

unread,
Feb 18, 2015, 11:13:02 AM2/18/15
to
I can't get it to work with Excel 2007 or 2013 either. I wonder if there was a patch in the last round of MS Office Updates?

GS

unread,
Feb 18, 2015, 11:34:35 AM2/18/15
to
Best solution for the buck, IMO, I've ever found...

http://dombajsoft.com/protectvba.htm

..where it generates a protected copy for distributing and lets you
work with the original version in the normal fashion!

Displays "Project is unviewable" same as JKP's solution does, but not
'undoable' like JKP's is.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


prof...@gmail.com

unread,
Feb 18, 2015, 1:07:42 PM2/18/15
to
Unfortunately, I'll have to wait until I get home to look at it. My Work blocked that page.

However, using the code equivalent of JKP's solution I was able to get it to work (on 2007, haven't tried 2013):

Workbooks("test.xla").SaveAs "c:\test.xla", AccessMode:=xlShared

GS

unread,
Feb 18, 2015, 1:22:29 PM2/18/15
to
And so is undoable, allowing 'savy' users to 'break in'. The solution I
use requires binary editing of the file for do/undo and so not so easy
to 'break in' for most. Also lets me use 'version stamping' on the fly
so my install knows when it's upgrading vs updating apps that require a
license.

Spreadsheet1com

unread,
Apr 16, 2015, 12:19:30 PM4/16/15
to
Unviewable+ VBA Projects for Excel & Powerpoint

http://spreadsheet1.com/unviewable-vba-project-app-for-excel.html

An Unviewable VBA project cannot be defeated by numerous password hacking software, such as this password recovery add-in. The unviewable plus VBA application is NOT based on the old shared workbook trick, which is easy to overcome and cannot be created, if there are Tables in your workbook or add-in.

The software is an executable that will turn your add-in (or workbook) into an add-in (or workbook) with an unviewable VBA project. Besides Excel macro-enabled files, the unviewable+ application can also protect PowerPoint presentations.

GS

unread,
Apr 16, 2015, 3:06:44 PM4/16/15
to
This does same for all MS Office apps and most others that license VBA.
It only costs $20...

http://dombajsoft.com/protectvba.htm

..and hasn't been broken yet (AFAIK)!

Spreadsheet1com

unread,
May 3, 2015, 2:58:48 PM5/3/15
to
Buy/Download links seem broken or non-valid anymore from my end. It looks like an abandoned project.

Not every VBA projects that is reported as unviewable in VBE is created equal. Unviewable+ packs more tricks behind the hood. Read more:

http://spreadsheet1.com/unviewable-vba-project-app-for-excel.html

GS

unread,
May 3, 2015, 3:44:31 PM5/3/15
to
> Buy/Download links seem broken or non-valid anymore from my end. It
> looks like an abandoned project.

Hmm.., you appear to be correct. I don't know the status of the product
as I've been using it for some years and so not keeping track. I'm sure
contacting them will fix the situation!

>
> Not every VBA projects that is reported as unviewable in VBE is
> created equal. Unviewable+ packs more tricks behind the hood. Read
> more:

Yes, I know this! I read extensively about Unviewable+ after a
recommendation by Chris Newman. It appears to modify the binary in the
same way PVC does, to render VBA projects unviewable!

Spreadsheet1com

unread,
May 5, 2015, 5:47:33 PM5/5/15
to
PVC should be identical to Unviewable+ SIMPLE protection level. I believe that's where the similarities end. Certainly, it was a great program when it was first launched many years ago. Hacking methods have become more sophisticated since then, hence the need for a stronger protection.

pbarw...@gmail.com

unread,
Nov 27, 2015, 7:19:44 AM11/27/15
to
hi,

I have tried JKP process and it works but my file contains web quires and when try to run it shows runtime error 1004 is there any solution for this?

regards,

Prashant

GS

unread,
Nov 27, 2015, 12:42:49 PM11/27/15
to
Unviewable+
It's not free!

witek

unread,
Nov 27, 2015, 4:11:02 PM11/27/15
to
GS wrote:
>
> Unviewable+
> It's not free!
>
Did you have a case when it did not work?


GS

unread,
Nov 27, 2015, 4:28:19 PM11/27/15
to
No cases that I'm aware of!

witek

unread,
Nov 27, 2015, 5:53:40 PM11/27/15
to
GS wrote:
>> GS wrote:
>>>
>>> Unviewable+
>>> It's not free!
>>>
>> Did you have a case when it did not work?
>
> No cases that I'm aware of!
>


Thanks
I will try it.
I do no need anything more just VBA protection.



GS

unread,
Nov 27, 2015, 7:16:20 PM11/27/15
to
It doesn't do anything else. It renders the same 'effect' as JKP's
shared workbook trick, (which as you probably know can be undone) by
altering the binary at various levels. Only admitted flaw to date is
that if you use the 'optional' advanced protection it loses a level
when you save your file. IMO, that degree of protection is overkill
anyway and so i not an issue with me!<g>

witek

unread,
Nov 27, 2015, 9:50:30 PM11/27/15
to
GS wrote:
>> GS wrote:
>>>> GS wrote:
>>>>>
>>>>> Unviewable+
>>>>> It's not free!
>>>>>
>>>> Did you have a case when it did not work?
>>>
>>> No cases that I'm aware of!
>>>
>>
>>
>> Thanks
>> I will try it.
>> I do no need anything more just VBA protection.
>
> It doesn't do anything else. It renders the same 'effect' as JKP's
> shared workbook trick, (which as you probably know can be undone) by
> altering the binary at various levels. Only admitted flaw to date is
> that if you use the 'optional' advanced protection it loses a level when
> you save your file. IMO, that degree of protection is overkill anyway
> and so i not an issue with me!<g>
>
It did not work. pivot tables, external data. I do not remember exactly
why I couldn't use it.



GS

unread,
Nov 27, 2015, 10:01:30 PM11/27/15
to
My understanding is that the latest release of unviewable+ 'just
works'! I don't use it myself but I've done extensive work with another
monitor of these NGs (who is a MVP I will not name). I do know the
issues you cite are common with shared workbooks and so I suspect any
methodology that messes with anything to do with that feature will
cause trouble.

Of course, there's always the option to go DLL or COMAddin!

witek

unread,
Nov 28, 2015, 2:11:12 AM11/28/15
to
GS wrote:
> Of course, there's always the option to go DLL or COMAddin!

I did it about 7 years ago.
I moved all calculation logic to C++
Unfortunately a couple of things must stay in VBA or we simply do not
want client to add anything to VBA.

What I do is more like document facing project . File can be send around
the world.
I can't install anything. All VSTO or DLL requiring registration with
admin right can't be used.


GS

unread,
Nov 28, 2015, 2:14:54 AM11/28/15
to
Not even if your installer runs with elevated permissions?

witek

unread,
Nov 28, 2015, 2:38:02 AM11/28/15
to
GS wrote:
>> GS wrote:
>>> Of course, there's always the option to go DLL or COMAddin!
>>
>> I did it about 7 years ago.
>> I moved all calculation logic to C++
>> Unfortunately a couple of things must stay in VBA or we simply do not
>> want client to add anything to VBA.
>>
>> What I do is more like document facing project . File can be send
>> around the world.
>> I can't install anything. All VSTO or DLL requiring registration with
>> admin right can't be used.
>
> Not even if your installer runs with elevated permissions?
>

Clients do not have rights to install anything.
They work on virtual desktops and every time they login they see brand
new computer. Nothing stays except data on shared drives.

They other reason is that they do not want to install anything.
They want to open excel file, do their work and send that file to
another person.
I call that iPhone syndrome. One button click and nothing more advanced.

GS

unread,
Nov 28, 2015, 10:38:37 AM11/28/15
to
Yes, I get that. My solution for portable apps (run from USB drive) is
to run DLLs reg-free via LoadLibrary(). No reason you can't do same
other than it requires you ship the DLL with your workbook. This
clearly won't work in your scenario!

Perhaps you can have someone using a current release unviewable+ lock
your VBA project so you can give it a test drive!?

witek

unread,
Nov 28, 2015, 3:37:59 PM11/28/15
to
GS wrote:
>> GS wrote:
>>>> GS wrote:
>>>>> Of course, there's always the option to go DLL or COMAddin!
>>>>
>>>> I did it about 7 years ago.
>>>> I moved all calculation logic to C++
>>>> Unfortunately a couple of things must stay in VBA or we simply do not
>>>> want client to add anything to VBA.
>>>>
>>>> What I do is more like document facing project . File can be send
>>>> around the world.
>>>> I can't install anything. All VSTO or DLL requiring registration with
>>>> admin right can't be used.
>>>
>>> Not even if your installer runs with elevated permissions?
>>>
>>
>> Clients do not have rights to install anything.
>> They work on virtual desktops and every time they login they see brand
>> new computer. Nothing stays except data on shared drives.
>>
>> They other reason is that they do not want to install anything.
>> They want to open excel file, do their work and send that file to
>> another person.
>> I call that iPhone syndrome. One button click and nothing more advanced.
>
> Yes, I get that. My solution for portable apps (run from USB drive) is
> to run DLLs reg-free via LoadLibrary(). No reason you can't do same
> other than it requires you ship the DLL with your workbook. This clearly
> won't work in your scenario!

Aplication.RegisterXLL
It solves a lot of problems with complicated calculation processes and
does not require any registration.


>
> Perhaps you can have someone using a current release unviewable+ lock
> your VBA project so you can give it a test drive!?
>
I will try it when I find a minute free time.


conexi...@gmail.com

unread,
May 9, 2016, 8:42:18 PM5/9/16
to
9 de mayo de 2016, Hi Jan, i try to do this with excel 2011 for mac, but it didn´t work.
there are something leatherlike this in excel 2011 mac ?



El domingo, 17 de enero de 2010, 12:50:40 (UTC-5), Jan Karel Pieterse escribió:
> Hi 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

ajayp...@gmail.com

unread,
Oct 9, 2017, 11:47:35 AM10/9/17
to
I just don't understand, GS and Witek, Why everyone in this world wants everything for Free? Particularly, even when you can afford to pay?

Please do appreciate someone's efforts at-least...

I am new to this work.. @57.

But couldn't resist responding, even after 2 yeas of last post..

Cheers Guys..

Ajay

Auric__

unread,
Oct 9, 2017, 9:42:33 PM10/9/17
to
ajaypunjani wrote:

> I just don't understand, GS and Witek, Why everyone in this world wants
> everything for Free? Particularly, even when you can afford to pay?
>
> Please do appreciate someone's efforts at-least...
>
> I am new to this work.. @57.
>
> But couldn't resist responding, even after 2 yeas of last post..

"Free" is not necessarily a bad thing. All of my publicly-available projects
have been released for free. (Also open source, a not-entirely-related
subject.)

I'm not willing to dig out the old thread just to get some context, but as a
general rule, why should I pay for something when there's something else just
as good (or almost so) that is free? It doesn't matter whether or not I can
afford it.

--
I always hated kids.

er.ha...@gmail.com

unread,
Jun 21, 2018, 11:26:19 AM6/21/18
to
Thank you Jan..

It worked perfect for me. I hope this cannot be further broken by any means?? Actually an year of my work got stolen by another person by a readily available software from google. Thanks a lot man!! This is a savior. I hope this is the ultimate sacurity?? Please let me know.

Thanks

With best regards
Hasan

er.ha...@gmail.com

unread,
Jun 21, 2018, 12:03:55 PM6/21/18
to
It works for me. If you follow the steps given by Jan it works perfectly unless if you have tables or XML. May I know what is the error message that you get.. Thanks

er.ha...@gmail.com

unread,
Jun 21, 2018, 12:09:50 PM6/21/18
to
Hi Jan/All

Also for one of my other projects I have TABLES. Is there any workaround for making this work for Workbooks with tables?? Thanks in Advance

Auric__

unread,
Jun 22, 2018, 1:56:04 AM6/22/18
to
er.hasanmj wrote:

> It worked perfect for me. I hope this cannot be further broken by any
> means?? Actually an year of my work got stolen by another person by a
> readily available software from google. Thanks a lot man!! This is a
> savior. I hope this is the ultimate sacurity?? Please let me know.

The original post was ***EIGHT FUCKING YEARS AGO!!!***

> On Sunday, January 17, 2010 at 11:20:40 PM UTC+5:30, Jan Karel Pieterse
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Do you really think Jan is still waiting around for more replies to this
thread? (Hint: No.)

--
What's a "Bunsen" anyway? And why would you want to burn one?

Imagine Líderes en Ofimática

unread,
May 10, 2022, 9:31:44 PM5/10/22
to
DPX method can desarm this , just try and see , the best way is traslate the code to dll but its more work
0 new messages