Prrojects, macros and where they are kept

D

Dave Neve

Hi

I don't really understand where my macros are.

Firstly, I think I may have a problem because when I open a certain
document, I notice that in Visual Bsic Editor that there are two projects
with exactly the same name.

Is this normal and how do I supprime a project cos 'the option is grayed
out'.

Secondly, and perhaps connected, when I try to organise my macros using the
organiser in Visual basic Editor, the window only shows 'New Macros' but
doesn't list the macros.

How can I transfer individual macros using this system if they don't appear?

Finally, I'd like to know a bit about macros and where they are stocked.

When I open my document, it seems that it doesn't contain any macros and yet
my macro buttons work.

I've noticed that the project window of VB Editor has a reference to a .dot
file which contains macros.

Is it better to install the macros onto the .doc file or to reference them
on the .dot file?

Thanks in advance

Dave Neve
 
S

Shauna Kelly

Hi Dave

If you create or record a macro, and you don't tell Word anything to the
contrary, they will be saved in normal.dot.

You'll find some information about how documents, templates and add-ins (or
global templates) work at:

What do Templates and Add-ins store?
http://www.mvps.org/word/FAQs/Customization/WhatTemplatesStore.htm

and

What is the relationship between a Word document and its template?
www.ShaunaKelly.com/word/attachtemplate/index.html

It is possible to store macros in a document or in a template. It's rare to
store them in a document, because you rarely need to use a macro on only one
document. And it would be silly to have the same macros stored in dozens of
different documents (maintenance would be a nightmare). It's more usual to
store macros in a template.

If you put your template in the location shown at Tools > Options > File
Locations > User Templates or > Workgroup Templates, then two things happen.
First, when you choose File > New, you can create a new document from that
template. Second, the macros in that template will be *available to* (not
stored in) any document that is based on that template.

If you put your template in the location shown at Tools > Options > File
Locations > Startup, or, if you choose Tools > Templates and Add-ins and
click Add to add your template to the list of add-ins, then the template
becomes a Global Template (also known as an Add-in). The macros in a global
template (or an add-in) are available to *all* documents that are open.

Normal.dot is peculiar in that it operates as a template (as a basis for a
new document) *and* simultaneously as a global template (making its macros
available to all open documents).

So your choice of storage location depends on whether you want your macros
to be available to all documents, or only to the documents attached to a
particular template.

If you're creating macros for your own use, then it's probably OK to save
them in normal.dot. But messing with other people's normal.dot is very bad
form. If you're going to give them to someone else, then create a separate
template, and store them there. See:

Distributing macros to other users
http://www.mvps.org/word/FAQs/MacrosVBA/DistributeMacros.htm

Now, about organizing macros: in the Visual Basic Editor, it seems you can
see the Project Explorer. If you double-click the name of a module (eg
"NewMacros"), you'll see a pane open with the code of the individual macros
in that module. You can create a new module using Insert > Module. And you
can copy and paste macros from module to module.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/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