Why do the macros disappear?

J

Jo Gjessing

Hi all,

In a Word document of mine I have a few macrobutton fields which look like
this: {MACROBUTTON NoMacro [Click here and write a text]}. Also I have a
macro connected to the BeforePrint event which colors the macrobutton fields
white so that they do not appear on print outs. A macro connected to the
AfterPrint event recolors them black afterwards. All of this work very well.
However, when I remame the file from <filename>.doc to <filename>.dot and
make a new .doc file from it, the macros disappear. Why is this and what can
I do so that the macros do not disappear? I can put them into the normal.dot
file, but that will be a great job because almost 350 users need them...

Have you any idea what I can do so please let me know. Thank you very much
in advance.

Jo
 
L

Lene Fredborg

You say you rename the doc file to doc. If this means that you simply change
the file extension from doc to dot, this does not convert your document to a
template. It will show a template icon but it is still a normal document. In
order to create a real template, you must save the document as a template,
i.e. select “Document Template (*.dot) in the Save As dialog box. The above
may be the cause of the problems you see. In that case, you could try the
following to see what happens:

Open a document you create based on the “fake†template you made. If you
look in Tools > Templates and Add-Ins, you will see that the attached
template is _not_ your fake template (because it is not a template). Instead,
it is the template on which your original .doc file was based (which may be
Normal.dot).

Instead of creating macros in templates used as the basis for documents, you
could create a separate template with all the macros, toolbars, etc. you want
to make available to users. Such template can function as an add-in that is
available to all documents if it is placed in the users’ Word Startup folder.
See:
http://www.word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 

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