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
[email protected]
Word MVP site: http://www.word.mvps.org
 
Top