ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding Part of the VBA Code (https://www.excelbanter.com/excel-programming/300197-hiding-part-vba-code.html)

matt

Hiding Part of the VBA Code
 
Hello Everyone

I've developed some query tools for querying databases. I
want to send them out to users but keep my code hidden.
From reading prior posts I've picked up

Lock you project in the VBE under the tools menu
= "Project Name"
Properties (Thanks Tom).

But what if I need to allow users to develop their own
code without seeing mine. I'm thinking something like the
veryhidden option for sheets, but for modules.

Thanks in Advance

Matt


keepITcool

Hiding Part of the VBA Code
 
if you protect your code (and save it as an addin), your users will be
able to write there own procs (using your public functions or
procedures... ) when they add a reference to your app.


So the only thing for you to do is decide which of the functions /
procs should be exposed to the users.

Those procs should be public while the rest should be Private.

You can make all procs in a module Private by putting following line in
the top of your module's decalaration section.

Option Private Module

My advice: first make everything private,
then add 1 module which is public and include some (wrapper) functions
there that external apps can access.

Check the Object browser to see which functions the addin exposes when
it's locked.



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt" wrote:

Hello Everyone

I've developed some query tools for querying databases. I
want to send them out to users but keep my code hidden.
From reading prior posts I've picked up

Lock you project in the VBE under the tools menu
= "Project Name"
Properties (Thanks Tom).

But what if I need to allow users to develop their own
code without seeing mine. I'm thinking something like the
veryhidden option for sheets, but for modules.

Thanks in Advance

Matt




matt

Hiding Part of the VBA Code
 
Thanks keepITcool

I'm afraid a lot of this is beyond me
Not sure how to
Save it as an addin

or

then add 1 module which is public and include some
(wrapper) functions

or

Check the Object browser to see which functions the addin
exposes when it's locked.

Is there anywhere I could go for detailed help with these?

Thanks

Matt


-----Original Message-----
if you protect your code (and save it as an addin), your

users will be
able to write there own procs (using your public

functions or
procedures... ) when they add a reference to your app.


So the only thing for you to do is decide which of the

functions /
procs should be exposed to the users.

Those procs should be public while the rest should be

Private.

You can make all procs in a module Private by putting

following line in
the top of your module's decalaration section.

Option Private Module

My advice: first make everything private,
then add 1 module which is public and include some

(wrapper) functions
there that external apps can access.

Check the Object browser to see which functions the

addin exposes when
it's locked.



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt" wrote:

Hello Everyone

I've developed some query tools for querying

databases. I
want to send them out to users but keep my code

hidden.
From reading prior posts I've picked up

Lock you project in the VBE under the tools menu
= "Project Name"
Properties (Thanks Tom).

But what if I need to allow users to develop their own
code without seeing mine. I'm thinking something like

the
veryhidden option for sheets, but for modules.

Thanks in Advance

Matt



.


keepITcool

Hiding Part of the VBA Code
 


Save as addin:
in Excel file/saveas
in the type dropdown... at the bottom you'll find:
Microsoft Excel Addin (*.xla)



any half decent book on VBA will spend at least a chapter on variables
and scope... but you've got to read the tedious stuff as well.

read up on :

Public Sub / Function
Private Sub / Function
Option Private Module


Object Browser:
in VBE press [f2]
you can explore all properties and functions of your projects and the
libraries selected in Tools/References.



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt" wrote:

Thanks keepITcool

I'm afraid a lot of this is beyond me
Not sure how to
Save it as an addin

or

then add 1 module which is public and include some
(wrapper) functions

or

Check the Object browser to see which functions the addin
exposes when it's locked.

Is there anywhere I could go for detailed help with these?

Thanks

Matt


-----Original Message-----
if you protect your code (and save it as an addin), your

users will be
able to write there own procs (using your public

functions or
procedures... ) when they add a reference to your app.


So the only thing for you to do is decide which of the

functions /
procs should be exposed to the users.

Those procs should be public while the rest should be

Private.

You can make all procs in a module Private by putting

following line in
the top of your module's decalaration section.

Option Private Module

My advice: first make everything private,
then add 1 module which is public and include some

(wrapper) functions
there that external apps can access.

Check the Object browser to see which functions the

addin exposes when
it's locked.



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt" wrote:

Hello Everyone

I've developed some query tools for querying

databases. I
want to send them out to users but keep my code

hidden.
From reading prior posts I've picked up

Lock you project in the VBE under the tools menu
= "Project Name"
Properties (Thanks Tom).

But what if I need to allow users to develop their own
code without seeing mine. I'm thinking something like

the
veryhidden option for sheets, but for modules.

Thanks in Advance

Matt



.




matt

Hiding Part of the VBA Code
 
Thanks keepITcool

Didn't realise an .xla was so simple
And F2 included my own procedures

Will get on to that wrapping stuff in a book

Thanks again

Matt


-----Original Message-----


Save as addin:
in Excel file/saveas
in the type dropdown... at the bottom you'll find:
Microsoft Excel Addin (*.xla)



any half decent book on VBA will spend at least a

chapter on variables
and scope... but you've got to read the tedious stuff as

well.

read up on :

Public Sub / Function
Private Sub / Function
Option Private Module


Object Browser:
in VBE press [f2]
you can explore all properties and functions of your

projects and the
libraries selected in Tools/References.



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt" wrote:

Thanks keepITcool

I'm afraid a lot of this is beyond me
Not sure how to
Save it as an addin

or

then add 1 module which is public and include some
(wrapper) functions

or

Check the Object browser to see which functions the

addin
exposes when it's locked.

Is there anywhere I could go for detailed help with

these?

Thanks

Matt


-----Original Message-----
if you protect your code (and save it as an addin),

your
users will be
able to write there own procs (using your public

functions or
procedures... ) when they add a reference to your app.


So the only thing for you to do is decide which of the

functions /
procs should be exposed to the users.

Those procs should be public while the rest should be

Private.

You can make all procs in a module Private by putting

following line in
the top of your module's decalaration section.

Option Private Module

My advice: first make everything private,
then add 1 module which is public and include some

(wrapper) functions
there that external apps can access.

Check the Object browser to see which functions the

addin exposes when
it's locked.



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt" wrote:

Hello Everyone

I've developed some query tools for querying

databases. I
want to send them out to users but keep my code

hidden.
From reading prior posts I've picked up

Lock you project in the VBE under the tools menu
= "Project Name"
Properties (Thanks Tom).

But what if I need to allow users to develop their

own
code without seeing mine. I'm thinking something

like
the
veryhidden option for sheets, but for modules.

Thanks in Advance

Matt



.



.


keepITcool

Hiding Part of the VBA Code
 
with 'a wrapper function' I mean following

in a Private Module you have say
Function DoTheEasyStuff(x)
DoTheEasyStuff= x & " was done"
end Function

Now in a Public Module you have:
Public Function MyCustomFunction(YourStringArgument As String)
MyCustomFunction=DoTheEasyStuff(YourStringArgument )
end sub

The latter 'wraps' or packages the internal procedure into something
more elaborate (or simple) which the 'external' user can see.

that's it. sorry for the lingo.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt" wrote:

Thanks keepITcool

Didn't realise an .xla was so simple
And F2 included my own procedures

Will get on to that wrapping stuff in a book

Thanks again

Matt


-----Original Message-----


Save as addin:
in Excel file/saveas
in the type dropdown... at the bottom you'll find:
Microsoft Excel Addin (*.xla)



any half decent book on VBA will spend at least a

chapter on variables
and scope... but you've got to read the tedious stuff as

well.

read up on :

Public Sub / Function
Private Sub / Function
Option Private Module


Object Browser:
in VBE press [f2]
you can explore all properties and functions of your

projects and the
libraries selected in Tools/References.



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt" wrote:

Thanks keepITcool

I'm afraid a lot of this is beyond me
Not sure how to
Save it as an addin

or

then add 1 module which is public and include some
(wrapper) functions

or

Check the Object browser to see which functions the

addin
exposes when it's locked.

Is there anywhere I could go for detailed help with

these?

Thanks

Matt


-----Original Message-----
if you protect your code (and save it as an addin),

your
users will be
able to write there own procs (using your public
functions or
procedures... ) when they add a reference to your app.


So the only thing for you to do is decide which of the
functions /
procs should be exposed to the users.

Those procs should be public while the rest should be
Private.

You can make all procs in a module Private by putting
following line in
the top of your module's decalaration section.

Option Private Module

My advice: first make everything private,
then add 1 module which is public and include some
(wrapper) functions
there that external apps can access.

Check the Object browser to see which functions the
addin exposes when
it's locked.



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt" wrote:

Hello Everyone

I've developed some query tools for querying
databases. I
want to send them out to users but keep my code
hidden.
From reading prior posts I've picked up

Lock you project in the VBE under the tools menu
= "Project Name"
Properties (Thanks Tom).

But what if I need to allow users to develop their

own
code without seeing mine. I'm thinking something

like
the
veryhidden option for sheets, but for modules.

Thanks in Advance

Matt



.



.





All times are GMT +1. The time now is 12:16 PM.

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