How to distribute a VBA macro and related stuff?

S

Senapathy K

Hello,

I am using Outlook 2003.
My intention is to avoid having to write boilerplate stuff in frequently
sent mails.
So I wrote a couple of VBA macros for Outlook.
The macros show VBA forms to get some input data from the user. Based on the
inputs it creates a new mail and just displays the mail item. Now the user
can just send the mail item after editing the contents if required.

Now I have:
- 1 Module (with 2 public routines)
- 2 User forms
- The VBA code for the 2 forms above

I created a new toolbar and added buttons for the 2 macros in my Outlook.
They work fine.

Now my question is:
How do I distribute these things to other people so that they can also
utilize this?
I tried exporting the forms and the module. The forms get exported to some
".frm" and ".frx" files and the module results in a .bas file.
Can I distribute these to others? Will it work if they import these to some
place?

Or is it required to create a COM Addin for distribution? I would prefer not
to do so, because no one can edit the DLL if they want to customize / modify
the stuff in the macro.

What is the best way to distribute such macros & forms?

Warm regards,
Sena
 
S

Sue Mosher [MVP-Outlook]

A COM add-in is the correct approach for distributing code within an
organization.

You also can make all the exported module files to other users and tell them
how to import them.
 
S

Senapathy K

Thanks for the reply Sue! But I am not sure which is the best way to import
on another user's machine.
When I export the forms and the module, I get some .frm, .frx and .bas files
Now does the other user have to open Alt+F11 in Outlook, and then import the
frames and modules that I exported?
Is this the only way for him/her to do it? This sounds kind of cumbersome to
me.

On the other hand, as you suggested, a COM Add-in would be more natty. But I
do not want to invest too much effort into packaging the VBA stuff into a
COM Add-in. Is it easy enough to do it? Do I need to know about the COM
automation interfaces exposed by Outlook to achieve this? Any pointers about
how to create a COM Add in for Outlook would be greatly appreciated.

With this dll, I can ask the users to simply use the Outlook Com Add in
manager to point to my DLL and they would be able to run the macros, I
suppose. On loading the DLL, perhaps I could even provide the custom Toolbar
with buttons for running the macros. Is it true?

Warm regards,
Sena
 
S

Sue Mosher [MVP-Outlook]

There is no "best way" only one way -- File | Import. Some people might
advise you to distribute your VbaProject.otm file, but that would blow away
any macros the user already has.

It's cumbersome because Outlook VBA code was never designed to be
distributed to other users.

See http://www.outlookcode.com/d/comaddins.htm for information and samples
if you want to create a COM add-in. It can include code to create a custom
toolbar. You will have to install the add-in on every machine.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
S

Senapathy K

Hello Sue,

Sorry for replying quite late to your original post.
I checked out the link that you gave - it was very helpful. I have now
succeeded in packaging the macros in a COM add-in, and it works very well.
Thanks so much for your help!

Regards,
Sena
 

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