Include external subs / functions / forms

  • Thread starter Bert Van Aerschot
  • Start date
B

Bert Van Aerschot

Hi all,

I've made made word templates (.dot files) with VBA code for a letter, fax,
memo, ...
The code (mostly subs and a few forms ) is within the templates but if you
make a new instance the code is included in the new document.

the code only runs on "document_New()" so it is not necessary that it is
within the documents (.doc). Is there a way to exclude the code in the
generated documents so that they still run on document_new() but are not
included when the templates are send to somebody else who does not have te
templates or is saved on the desktop.

I was looking for a way to include the necessary code from another file so
that once the file is send to somebody else the size of the docs is lower
too.

I've searched on google but I can't seem to find the right keywords for the
results I want, any help on that would be appreciated too.


thx in advance for your time to answer,

Bert
 
P

Peter Hewett

Hi Bert Van Aerschot

If you've created a true template then the code will not get propagated to any documents
created from it. This behavior only happens if you're actually using a document as a
template.

When you created your template did you rename it from a ".doc" to a ".dot"? Word always
know what "type" a file really is, it does not use the file type (the .doc or .dot suffix)
to determine what the files real type. It determines what type a file is by scanning the
files binary content.

So try creating a new Template from your current template/document and when you first save
it make sure it type is "Document Template (*.dot)".

HTH + Cheers - Peter
 

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