Template macros are not in doc created with template

M

Markw911

Hello. I have a word template that has a macro in it. The macro reads some
data in from an Outlook com addin. Right now I am just popping a message box
to test it. When I open the template and a new document (test1.doc) opens,
the macro is not available in it. I want this macro to run automatically so
selecting it from the macros dialog is not an option. Is there a way to
force the macros in a template to go with the new documents that get created
from this template?
Thanks, Mark
 
J

Jean-Guy Marcil

Markw911 was telling us:
Markw911 nous racontait que :
Hello. I have a word template that has a macro in it. The macro
reads some data in from an Outlook com addin. Right now I am just
popping a message box to test it. When I open the template and a new
document (test1.doc) opens, the macro is not available in it. I want
this macro to run automatically so selecting it from the macros
dialog is not an option. Is there a way to force the macros in a
template to go with the new documents that get created from this
template?
Thanks, Mark

See the Document event in the ThisDocument module of your template.

Display the ThisDocument code pane, list the content of the dropdown list at
the top of the code window on the left, choose Document. Finally, choose an
event in the dropdown on the right.

Put your code inside the event sub that gets inserted when you select an
event. You want Document_New

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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