Prevent macro in template being saved to documents

S

Stefan

Hello,

I'm in the process of writing my own interface to an
index server catalog, and I am also using a macro in my
templates to ensure that title, subject and other custom
properties are saved for all the documents.

At the moment, the macro is working fine, but if possible
I would like to prevent the macro itself being saved to
the documents resulting in the use of the templates. The
reason for this is that index server is not filtering the
documents that contain the macro for some reason.

Any suggestions would be much appreciated.

Thanks,
Stefan
 
H

Howard Kaikow

Macros do not get automatically copied from a template to another template
or to a document.
 
G

Guest

When I use a template and save a document, the template
is saved to the document as well, and it's free of virus.
 
J

Jay Freedman

Hi, Anon.

I think you're misunderstanding what's happening. When you have a template
that contains macros, and you base a new document on that template, the
template is *not* saved in the document, and the templates' macros are *not*
saved in the document. The only thing saved in the document is the *name* of
the original template.

If you re-open the document on the same PC (or if you copy both the document
and the template to another PC and open the document there), then Word
"attaches" the template to the document -- you can see this in the Tools >
Templates and Add-Ins dialog. The document can use the template's macros. It
may look like the macros are in the document, but they're really still in
the template.

If you send the document to another PC *without* the template and open it
there, Word fails to find the original template, so it attaches Normal.dot
(as it exists on the second PC) instead. In that case the macros from the
original template will *not* be available.

If you deliberately copy the original template's macros into the document
(by using the Organizer or the VBA editor), then the macros will go along to
the second PC, and then you'll get the "possible virus" warning. But Word
never does this automatically, so there's nothing to prevent.
 
H

Howard Kaikow

When you OPEN a template and do a save, you are saving a template, not a
document.
When you create a NEW document based on a template, the macros do not get
saved with the document. The macros are available ONLY when the template is
attached to the document. So if you create such as document and use the
document on a system that does not have the template, then you will not have
access to the macros, which are stored in the template.
 
S

Stefan

Hello,

Thanks for the detailed reply (thanks to others that
replied too.) I do understand now and I can see that the
macro is listed in the "Active documents and templates"
view. What I would like (if possible) is to be able to
double click on a .dot file to create a new document.
Once I save the resulting document, I would like to avoid
saving the association to the original templates This is
because everyone who will continiously open these
documents also have access to the original template.

I'm working on getting a digital certificate which would
eliminate the "disable/enable macros" warning which is
the ultimate goal (Index server is now indexing the
documents properly with W2K SP4), but in the mean time I
would like to try to remove this link between the
document and its original template.

Many thanks,
Stefan
 
J

Jay Freedman

Hi, Stefan,

Every document is always associated with some template. You can change the
association from one template to another, so you can remove the reference to
the original template by replacing it with Normal.dot. Wherever the document
is opened, it will associate with the Normal.dot on that PC, not with the
one on your machine.

I think all you need to do is this:

- Open the Tools > Templates and Add-Ins dialog.
- Click the Attach button at the top of the dialog.
- Select Normal.dot and click the Open button.
- Click OK.
- Save the document.

Unfortunately, I don't have a way to test this now.
 
H

Howard Kaikow

Yes, that will work.

But, take care about which set of styles will be used.
Look at the Help for the "Automatically update styles" option.

In addition, why do you want to replace the attached template with
Normal.dot?
If you send the doc to someone who does not have the original template, they
can still use the document.
 

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