Macros disassociated from tool bar

D

Dave Neve

Hi

No doubt due to a bad manipulation, my macros seem to have become
dissasociated from their menus and tool bar icons.

I know that everything is 'in place' cos when I load the doc, Word asks me
if I want to activate the macros.

I can see them as well in VB.

In the Word document, my special menus and tool bar icons are also visible
but when I click on them, I get a message that the macros are either
disactivated (which I doubt cos Word had invited me to activate them 2
seconds before) or that they are dissassociated.

How to I reassociate them please?

Thanks in advance
 
C

Cindy M -WordMVP-

Hi Dave,

You either recreate the toolbar buttons. Or you have to use VBA code to set
the .OnAction property. (Note that renaming the template's project or
renaming a macro can cause macros to "unlink" from toolbar buttons.)

Dim cb as Office.CommandBar

Set cb = CommandBars("The caption")

cb.Controls(1).OnAction = "Macro name for first button"
In the Word document, my special menus and tool bar icons are also visible
but when I click on them, I get a message that the macros are either
disactivated (which I doubt cos Word had invited me to activate them 2
seconds before) or that they are dissassociated.

How to I reassociate them please?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :)
 
C

Chad DeMeyer

Dave:

CommandBars("Name").Controls(Number).OnAction = "macroname"

You can execute the above line in the Immediate window or in a subprocedure.
If you don't know the number of the CommandBarControl, you can loop through
the collection of controls on the command bar (For Each oControl In
CommandBars("Name").Controls) and test the .Caption property of each
control.

Regards,
Chad
 

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