Word 2007 - Leave macros in document or detach from template

A

Adri

We create many documents from templates which contain macros. The macros are
only required when the document is created (ie they are AutoNew), and the .
Our documents are then saved using a document management system to a location
that is not a trusted location for macros.

So when we re-open those documents, they prompt that macros have been
disabled and to enable or not.

It seems my choices are:
1. as part of the AutoNew macro, add code to detach from the template
2. add the location as a trusted location for macros
3. leave as is and deal with the prompt (not what I really want to do)
4. set macro security to enable all macros (not an option for us)

I'm interested in what you all think - choice 1 or 2 above?

Thanks...
 
D

Doug Robbins - Word MVP

If you use File>New to create a document from a template that contains
macros, those macros are NOT saved with the document when the saving is done
by Word. If they are being saved with the document, it must be something
that is being done by the document management system.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
A

Adri

Hi Doug,

The macros are not actually saved in the resulting document, but they are
still in the attached template, which seems to trigger the security prompt.

We use the same doc mgmt system for 2000 and 2007. I only get a security
prompt come up in 2007, not 2000, which I assume has something to do with the
changes they've made to macro security. I could lower the security but I'd
rather not do that.

So I figured my other two options are to make the document storage location
a trusted location, or to detach the document from the template.

Just wondered if anyone had a preference for doing one or the other.
 
D

Doug Robbins - Word MVP

The template is not attached to the document in the location in which the
document is saved. When a document is opened in Word, if the template from
which it is created is available on the machine on which the document is
being opened, a reference to the template is created. That would not
normally trigger a macro warning message.

If you save such a document outside of the document management system and
close it and then re-open it, do you then get the warning message?

What is the AutoNew macro doing?

I guess at the end of the code in it, you could use the command

ActiveDocument.AttachedTemplate = "[templatepath]\normal.dotm"

to attach the normal.dotm template to the document before it is saved.

But, it should not be necessary.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

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