Link to home
Start Free TrialLog in
Avatar of gary_j
gary_jFlag for United States of America

asked on

Making VBA code for the application, not the instance

Two examples --

If I write a VBA module for an Excel workbook, and I want that module to be available every time someone opens Excel (not the workbook it was written in) -- can that be done?

If I write VBA for Outlook, using, for example, the newmail event, can that code be made available network-wide or is it just for my workstation only?

Thank you

ASKER CERTIFIED SOLUTION
Avatar of jmacmicking
jmacmicking
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of byundt
byundt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Putting files in the XLSTART folder, Personal.xls and .xla add-ins are all valid solutions for a single user profile on a single workstation. This installation must be repeated for each different user and workstation in the system.

If you use functions from your add-in in a workbook you develop--it will work fine on your computer. But it won't work at all on a co-workers computer unless you also provide a copy of the add-in. For this reason, I prefer to package all the required code with each workbook I distribute to coworkers. This allows the files to be shared freely, both inside and outside the company.

The add-in approach is more useful if other people frequently develop spreadsheets for their own use, and wish to use functions and subs that you have written. As long as everybody has the add-in, maintenance is simpler because just one add-in needs to be updated (on each computer) rather than a large number of workbooks on each computer that were packaged with all the required VBA code.