Execute code from other document?

R

Rvo

Hi,

I want to run a macro which is in another template (this template is loaded
at Wordstart). How do I do this?

Thanks for your interest,

Romain
 
S

Steve Lang

Hi Romain,

Make sure you add a reference to the template that is loaded at start
up(MyStartup.dot) in the one you are coding (MyCalling.dot), and make sure
the macro has a public scope:

Public Sub MyCalledMacro 'In MyStartup.dot
'does something useful
End Sub

Then reference it like this in Mycalling.dot:

Sub Foo 'In MyCalling.dot
'Reference the Module and Sub
MyStartupModule.MyCalledMacro

End Sub

HTH and have a great day!

Steve
 
R

Rvo

Thanks Steve, that DID help :)

Steve Lang said:
Hi Romain,

Make sure you add a reference to the template that is loaded at start
up(MyStartup.dot) in the one you are coding (MyCalling.dot), and make sure
the macro has a public scope:

Public Sub MyCalledMacro 'In MyStartup.dot
'does something useful
End Sub

Then reference it like this in Mycalling.dot:

Sub Foo 'In MyCalling.dot
'Reference the Module and Sub
MyStartupModule.MyCalledMacro

End Sub

HTH and have a great day!

Steve
 

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