Word 2007 macros

M

Michelle

I used to make macros in 2003 with the suffix of .MAIN. This allowed me to
copy individual macros from one template to another, one computer to another.
If I failed to use the .MAIN, I was given only the choice of NEWMACROS to
copy. Of course, if the destination also had NEWMACROS, they'd be
overwritten.

Now I am trying to do the same with 2007. I created 4 macros with .MAIN
suffix and put them on the Quick Access Toolbar (with a view to putting the
same macros on three different computers). However, whichever macro I click
on, they are all the same macro. If I run them from Macro, Play, they work
perfectly, but on the toolbar, they all think they are the same macro! This
is very frustrating to say the least. And whoever at Microsoft came up with
the Quick Access Toolbar (which is something out of Microsoft 1.0) should be
flogged...but I digress.

Can anyone explain (in very easy language please - I am VBA challenged) what
the heck I can do here to a)make the macros behave on the Quick Access
Toolbar and b) how to get them from one computer to another if I can no
longer use the .MAIN suffix (which I have been told is my problem)?

Thanks, Michelle
 
D

Doug Robbins - Word MVP

I am not sure what you mean by "with the suffix of .MAIN"

Macros are contained in Modules in Templates. You can either install the
template on another machine, but I guess that most likely, you have created
the macros in the Normal.dot template on your machine and I would not
suggest copying that to another machine. In the visual basic editor,
however, you can select the module that contains your macros and then Right
Click and select Export File. That will export the module to a file with
the extension of .bas. You can copy that file to another machine and then
in the visual basic editor on that machine, you can select the template into
which you want to insert those macros and from the File menu, select Import
File and then select the .bas file to be imported.

See the article "Distributing macros to other users†at:
http://www.word.mvps.org/FAQs/MacrosVBA/DistributeMacros.htm


--
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
 
G

Graham Mayor

By default, Word saves macros you create in the NewMacros module. When
naming a macro from the macro recorder or the ALT+F8 dialog, you can create
(or use existing modules) by adding a *PREFIX* containing the module name.
If you use the extension '.main' when naming a macro, a macro called 'main'
is created in a module with the name of the body as the module name.
What you should do is use the name of the macro as the 'extension' i.e. if
you want the macro in a module called 'main', name the macro Main.macroname
This was exactly the same in Word 2003.
You should not use duplicate macro names in different modules of the same
template as it creates confusion.
In the case of Word 2007, you are correct that when adding a macro with the
same name from a different module to the QAT (Quick Access Toolbar) that the
one in the NewMacros module takes priority. Whether this is by design or a
bug I am not sure, but the answer is to use unique module names and modules.

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

My web site www.gmayor.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