VBA in .dot template - how to disconnect code?

K

Keith R

I have a .dot template that I've run into a few problems, but I don't have
the machines/software to systematically test every possible condition.

I have some VBA and userforms in a .dot that was created in Word97. At that
time, if the .doc ("child" document of the template) was opened on a
different Win95/Word97 machine (that didn't have the .dot), it gave an
error. This was an issue because the child document had to be emailed to
people without the .dot for later use and we didn't want to be throwing
errors or causing problems.

Our organization has since been upgraded to WinXP/OfficeXP (which is great)
and I tested the same situation- I created a child document, and then opened
on a machine without the .dot (a dummy workstation with only the basic
install of officeXP). The child .doc opened without a problem, and (even
though Word macro security was set to high) all the VBA functionality
(userforms, toolbars) still worked!!

So here's my question:

What is the appropriate way to set up a template so that we can generate
child documents on our machines with the template (generated in anything
from Word 97 to XP), and be able to send the child documents to anyone with
Word (97 through XP) and not throw errors /and/ not carry the code with it,
e.g. the end recepients of the child documents should not have access to the
..dot VBA functionality.

Any advice greatly appreciated,
Keith R
 
K

Keith R

Ack , half the problem is solved- turns out the corporate install of Word
points default files to our personal directories regardless of PC, so when
I changed the filename of the template, my Word XP problems are solved.

Still curious about Word97; I'll do some more testing then repost a
more specific question with symptoms.
 
P

Peter Hewett

Hi Keith R

There are a number of point to cover:

1. Create your template and code using the lowest version of Word you or your
user/clients use. In your case this will be Word 97. This ensures that you
develop for the version of Word with the least features.

2. The documents Word creates are binary compatible across versions, but not
all features are supported. If documents that are created from your template
are created in one version of Word and then edited in another you may when to
ensure that features introduced after Word 97 are disabled.

3. When you create a document Word keeps note of the Template name but it's not
very fussy about the template location! If the documents created from this
template are going to be used internally within your organisation and you do not
want them to have further access to the template once the document has been
created then you can attach the document to Normal.dot once it's been created.
This is not an issue if the document is only going to be sent outside your
organisation. As the template will not be present and Word will attach the
document to the users Normal.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