How to compile a Dll to use in VBA project?

J

Joe

Hi,

I would like to protect some of my code so people can't
view it.

Normally you could protect the document and protect the
VBE. However some people have code breakers and that
makes it a poor protection.

Yes I now there is no such thing as a 100% fail save
protection but I want the next best thing.

I know it's possible to compile a module in to a DLL or
something else and that you would be able to call the
functions within that DLL.

The problem is I've got no idea on how to do this.

Can someone please tell me How I can make a simple DLL
(Or something else that gives the same safety) that I can
use in my VBA project?

I'm thinking of a simple exercise here like:
* How do I build this DLL?
* How would I cal a simple function from within this DLL?
(Simple passing of parameter and receiving another back)
* How do I connect it to the project (Relations/Do I need
to register it with windows first)

I have Visual Studio.NET can I build it with that?

I'm open to al kinds off suggestions on how to proceed
otherwise.

Please advice,

Joe
 
J

Jezebel

No idea how this is done with VB.Net, but it's easy with VB and I assume the
method is essentially the same.

1. Put all your important code into the DLL, which will contain modules,
classes etc as needed.

2. You need a little bit of VBA code to initialise the DLL and -- depending
on what you're doing -- possibly to pass commands from Word (eg menu
commands) to the DLL. You can password-protect the VBA code if you want, but
it's usually so trivial that there's not much point.

3. Your DLL can respond to Word either directly -- your VBA code calls the
DLL's methods, or by trapping Word's application and document events.
 
J

Joe

Hi Jezebel,

Thnx for you're reply!

I have VB 6 (on CD not installed) so if push comes to
shovel I'll install it.

Been doing some reading and found out I need a ActiveX
DLL because that's the most compatible (so the say)
In its properties I have to name it so I can use
Intellisense form the VBE to call its children. (Subs,
functions)

So far so good but I still have to find out the most
basic stuff:
* When opening .NET witch kind of NEW project do I begin
to put my subs and functions in? (The one you are going
to compile)
* How do I actually compile this thing to ActiveX DLL (Is
there a wizard)

But I'll keep on reading stuff on the internet so I will
succeed! ;-)

Thnxx,
Joe
 
J

Jezebel

As I say, I know nothing about VB.Net. In VB you select DLL as the project
type, and away you go. Even debugging is straightforward: having compiled
the DLL once, to register it, you can then set the VB project running in
development mode: when Word initializes the DLL, it actually gets a
reference to the VB instance rather than the compiled version, so you can
step through the code and debug on the fly.
 
J

Joe

Hi Jezebel,

Ok I'll install VB6 to get on my way and try out you're
suggestions.

Thanx for helping me on my way...

Joe
 

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