Templates....with Form

M

mrodwell

I have a template which when opens loads up a userform....which works
by adding the load userform to the thisdocument section in vba.....
I have an issue now as when i load the template i want it to start a
new document (so not to loose the template) load the form. HELP

Mat
 
J

Jay Freedman

Hi Mat

You're not supposed to *open* a template except to change the template
itself. For day-to-day use, store the template in the folder listed as "User
Templates" in the Tools > Options > File Locations folder, and it will
appear as one of the choices in the File > New dialog. When you select it
there, Word will create a new document *based on* the template, and not
change the template at all.

In the template, the code to load the userform should be in a procedure
named Document_New() or Document_Open(). The _New one runs when you base a
new document on the template as described above; the _Open one runs when you
re-open any existing document based on the template. You can use either or
both, depending on when you want the userform to appear.

See http://word.mvps.org/faqs/macrosvba/DocumentEvents.htm.
 

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