Protecting XLA

P

PA

Hi,

I have to develop an application using VBA/EXCEL and I want to protect
as
much as possible the code. Macros are in the spreadsheet itself (just
a few like auto_open) and in a separate xla file.

Xla as far as I know can be open even if protected. can you please
advice any other way to protect it? I read somewhere that an option is
to create an .ocx. is this true? if so, does anyone know any good
reference on how to convert from XLA to OCX?

Thanks in advance
 
G

Gord Dibben

You can protect the *.xla VBAProject with a password so's code cannot be viewed.

VBAProject passwords are a little more difficult to crack than workbook internal
passwords but as all Excel security, fairly weak.

Can't answer the OCX question.


Gord Dibben MS Excel MVP
 
P

Peter T

OCX, I don't think so unless you need some sort of control. Probably an
ActiveX dll which would still require VBA wrapper in a workbook (xls/xla) or
similar as a ComAddin.

Can be adapted in various languages/apps. By far the easiest and as it
happens the most secure, would be VB6. 'Easy' is a relative term, quite a
learning curve if you've not done it before. Consider Gord's suggestion of a
project password which will deter the average user.

Regards,
Peter T
 
S

shrutzin

Hi

what about protecting the *.xla files through RMS? Is that possible? Like
using c#:
workbooks.open("filename.xla");
....
Add.permission(read.. or watever..?
 
P

Peter T

what about protecting the *.xla files through RMS? Is that possible?

Not sure what you mean but can'imagine how that would help protect the code
Like using c#:
workbooks.open("filename.xla");
...
Add.permission(read.. or watever..?

If I follow, you are wondering about opening as ReadOnly, which indeed you
can do. But that would only prevent the file being re-saved with same name
and while opened with your code
Could save with ReadOnlyRecommended:=True but that won't help at all.

IOW, there is no way to make your VBA code fully secure, plenty of password
crackers out there.

Regards,
Peter T
 
S

shrutzin

Hi
Thanks for replying but that is not what i meant,

Like any normal workbook(.xls) can be protected using IRM (windows right
management) through code or manually also; so cant we protect an xla file
also ? so that whenever anyone opens it it will first check for user
credentials? In this way no-one will be able to see the code but can load the
xla (from tools->add-in) for the feature it wants to use.
This is much safer tahn using passwords.
I am sorry if i was not clear earlier.
 
P

Peter T

Typically VBProject (where the code is) password crackers do not even open
the file, at least not in Excel. Instead they open file as in a Hex editor,
search for certain markers, replace sections that follow that represent the
password with own known password, write the amended file back to disk
(either with new name or with same name having renamed original file as say
*.bak). When done advise you of the new password.

AFAIK, whatever rights/permissions are assigned to the file or its folder
will not prevent the above.

Regards,
Peter T
 
S

shrutzin

hi
Typically VBProject (where the code is) password crackers do not even open
the file, at least not in Excel. Instead they open file as in a Hex editor,
search for certain markers, replace sections that follow that represent the
AFAIK even if one opens a right-protected file in hex editor ; he/she will
not be able to do the above as the file is encrypted, even the content :) so
it will still be protected ...the only thing i am not sure of is how to do
this by code :)

Thanks and regards
Shrutzin
 
P

Peter T

as the file is encrypted,
Really ?

Even if it is encrypted and/or readonly, once open in Excel user can do a
SaveAs, eg

With Workbooks("theAddin.xla")
.SaveAs "C:\temp\" & _
Replace(.Name, ".xla", "_01.xla")
End With

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top