call marco from another template

K

kevin

I have to templates that are loaded in the startup
folder. both contain a series of macros. Is there a way
I can create a macro in one template that call a macro in
the other template?
 
M

Mark Tangard

Hi Kevin,

Yes, you can do this. In the 'calling' template, set a
reference to the 'called' template, like this: Open the
former in the VBE, click Tools­> References, and check
the box next to the latter. (Note that the items in the
list you see are the VBA 'project' names, not necessarily
the file names.) Save and exit.

To call the macro: Let's assume the project name for
the called template is MyTemplateB, the macro you want
to run is named Macro72, and it lives in the module
named Module43. Use:

Call MyTemplateB.Module43.Macro72

Hope this helps.
 
Top