Calling macro code between (Word) VBA Projects

R

RJ Lohan

Hey,

Can anyone tell me how to call macro code from one .dot file to another?
I know about the Application.Run "macroname" option - but am wondering
if you can do something like; ProjectName.ModuleName.FunctionName() ?

I've seen something along these lines, but can't get it to work between
projects (works from within one project), and am confused about this
example I've seen...?

Cheers,
RJ
 
J

Jonathan West

You can set a reference from one template to another in Tools References.
This has the disadvantage that the path to the other template is hardcoded,
and so if you move the referenced template, the link is broken.

You can use a fully qualified projectname.modulename.Routinename in
application.run for any public Sub. You can't use it for functions though.
But this is not too much of a hardship, since you can pass values back to
the calling rotuine through the paramater list of the subroutine.
 

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