ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protecting XLA (https://www.excelbanter.com/excel-programming/401119-protecting-xla.html)

PA[_2_]

Protecting XLA
 
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


Gord Dibben

Protecting XLA
 
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

On Wed, 14 Nov 2007 20:09:12 -0000, PA wrote:

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



Peter T

Protecting XLA
 
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

"PA" wrote in message
ups.com...
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 ?

Thanks in advance




shrutzin

Protecting XLA
 
Hi

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


"Peter T" wrote:

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

"PA" wrote in message
ups.com...
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 ?

Thanks in advance





Peter T

Protecting XLA
 
"shrutzin" wrote in message
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


"Peter T" wrote:

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

"PA" wrote in message
ups.com...
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 ?

Thanks in advance







shrutzin

Protecting XLA
 
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.

"Peter T" wrote:

"shrutzin" wrote in message
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


"Peter T" wrote:

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

"PA" wrote in message
ups.com...
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 ?

Thanks in advance








Peter T

Protecting XLA
 
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

"shrutzin" wrote in message
...
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.

"Peter T" wrote:

"shrutzin" wrote in message
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


"Peter T" wrote:

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

"PA" wrote in message
ups.com...
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 ?

Thanks in advance










shrutzin

Protecting XLA
 

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

"Peter T" wrote:

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

"shrutzin" wrote in message
...
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.




Peter T

Protecting XLA
 
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


"shrutzin" wrote in message
...

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

"Peter T" wrote:

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

"shrutzin" wrote in message
...
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.







All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com