Template and macro

M

Marek

My Template (.dot) have macro. It saved current filled template into doc.
Macro is in template as Commandbutton1_Click().
When i save document as template and reopen it by double click, it opens as
project1.
Then button is doesn't run (but it's not blocked)
What i must do?
 
J

Jean-Guy Marcil

Marek was telling us:
Marek nous racontait que :
My Template (.dot) have macro. It saved current filled template into
doc. Macro is in template as Commandbutton1_Click().
When i save document as template and reopen it by double click, it
opens as project1.
Then button is doesn't run (but it's not blocked)
What i must do?

See
http://word.mvps.org/faqs/customization/CreateATemplatePart1.htm
for help on understanding how to use a template.

Here is one way of doing what I think you want to do:
In your case, I think you have to create the template that contains the
general lay out of your in-line form (including the button, but not the
code).
Then, generate a document from it,. Since you will be ending this form to
people al over the place (and that they will not have the template), attach
your document to the Normal.dot template (Tools > Templates and Add-ins...).
Then add the code to the button (In design mode, double click on the button
to access to Code pane).

Be warned that if your user have set their security to High, your code will
be deactivated and there is nothing you can do. You may want to include a
comment telling users that if they want to use the "Send" button, they have
to set their security to Medium or lower (Tools > Macros > Security). At
Medium they will be prompted to activate the macros or not.

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

Marek

Thank you very much!
It works fine :)

U¿ytkownik "Jean-Guy Marcil said:
Marek was telling us:
Marek nous racontait que :


See
http://word.mvps.org/faqs/customization/CreateATemplatePart1.htm
for help on understanding how to use a template.

Here is one way of doing what I think you want to do:
In your case, I think you have to create the template that contains the
general lay out of your in-line form (including the button, but not the
code).
Then, generate a document from it,. Since you will be ending this form to
people al over the place (and that they will not have the template),
attach your document to the Normal.dot template (Tools > Templates and
Add-ins...). Then add the code to the button (In design mode, double click
on the button to access to Code pane).

Be warned that if your user have set their security to High, your code
will be deactivated and there is nothing you can do. You may want to
include a comment telling users that if they want to use the "Send"
button, they have to set their security to Medium or lower (Tools > Macros
not.

--
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