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.
 

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