How to include macros in .doc file

A

acherony

HI,

I am using Word 2003.
I wrote template lets call it "test.dot" which uses macros.

When I create .doc file using test.dot on my PC I can use macros.

In Tools->Template and Add-ins->Document Template is path to the template
the .doc is based on. For Example C:\\...\test.dot

But when I created .doc on my PC and send it via email as attachment the
user in the other site can not use macros while the path to the template the
..doc is based on is not actuell.

My Problem is how can I include macros to the .doc document that it works on
every machine without having information about template.

Is it possible?
 
C

Cindy Meister

It is possible, yes.

You'd have to copy the macro modules from the template (the one you see in
Attached template) into the document. You can do this in one of two ways

1. Tools/Templates and Addins/Organizer. If the macros are not in
Normal.dot, click the Close button on the right. Then click it again (it is
now labelled "Open") and find the template with the macros. Select the macros
and click the "Copy" button to copy them to the document (listed on the left)

2. Press Alt+F11 to open the VBA Editor. Locate the "Template project" for
the template. Display all the sub-folders. Drag each entry in a sub-folder
(except ThisDocument) to the Document's project; this will copy them.
 
A

acherony

Thanks.

I did it with Alt+F11.
I need to do it automaticly when user create document from test.dot.
I suppose I need to write some macro to do it automaticly.

Q: How can I copy moduls+userform+classes from .dot to .doc when doc will be
created.

I would like to include it in autonew()

thanks
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?YWNoZXJvbnk=?=,
I did it with Alt+F11.
I need to do it automaticly when user create document from test.dot.
I suppose I need to write some macro to do it automaticly.

Q: How can I copy moduls+userform+classes from .dot to .doc when doc will be
created.

I would like to include it in autonew()
Here, again, the simplest method is to use the equivalent of Tools/Templates
and Addins/Organizer. Try recording the steps in a macro and see if it gives
you anything useful.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
G

Graham Mayor

While you can copy macros from template to document, I am not sure that I
would recommend such a ploy. If anyone were to send me a document with
macros in it, I would not even think about allowing them to run without
first checking them out carefully to see what they do. Many users will have
macro security set to high and this will disable the document macros. You
have no control over how users configure their security - nor should you.

If users need these macros, why not distribute them in an add-in template?
And if users are creating the documents why not supply the document
template?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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