Microsoft Office 2000/Visual Basic Programmer's Guide |
If you don't have Microsoft Visual Basic or don't want to create a DLL, you can create an application-specific template or add-in that contains reusable code for that application.
For example, if you have a set of procedures that you call regularly from code in Word, you can create a template that contains these procedures and set a reference to it from any Word VBA project that needs to use those procedures. To set a reference to a template (or any file that contains a VBA project), click References on the Tools menu, and use the Browse button to locate the template file.
Note that simply loading a global template in the Templates and Add-ins dialog box doesn't allow you to call the code that the template contains, except through a command bar control. You must set a reference to the template in order to call code in the template, even if the template is already loaded.
This solution allows you to keep application-specific code in an application-specific template, which doesn't have to be registered in the Windows registry, so it may be an easier solution to implement than a DLL. However, application-specific templates are larger than most DLLs and take longer to load, so your solution may be somewhat slower.