Word 2002 New Menu fails in 2nd document

P

Paul Frenay

I am using a VB add-in to create an additional menu entry.
This works fine, but ONLY in the first document.

In new documents (created from templates), the menus are still visible,
and they open and close interactively, but they don't execute. Clicking
them doesn't seem to evoke an event. The menu in document1 is not
affected.

I can make the New Menu work in the newer document by deleting and
recreating it, but then the instance in document1 degrades to passivity
!

Apparently the menubars from normal.dot and other templates do not
merge correctly. Any tips?
 
T

Tom Winter

Paul Frenay said:
I am using a VB add-in to create an additional menu entry.
This works fine, but ONLY in the first document.

In new documents (created from templates), the menus are still visible,
and they open and close interactively, but they don't execute. Clicking
them doesn't seem to evoke an event. The menu in document1 is not
affected.

I can make the New Menu work in the newer document by deleting and
recreating it, but then the instance in document1 degrades to passivity
!

Apparently the menubars from normal.dot and other templates do not
merge correctly. Any tips?

Sounds like you may want to check out Application.CustomizationContext. The
menu changes you make are always applied to some template, be it Normal.dot
or some other template. Making changes to normal.dot (by changes it menus
for example) is generally considered not a good idea. The best thing to do
might be to create a traditional .DOT template with the custom menus setup
as you want them, then have your COM Add-in load the .DOT add-in
(Application.Addins.Add...) when it starts. Then hook up with your menu
items using the .Find methods of the CommandBars, based on the menu items'
TAG property. You can check out my sample Word COM Add-Ins at
http://www.amosfivesix.com/downloads/. Though they contain a lot of other
stuff, they illustrate loading a .DOT add-in when a COM Add-In starts in
order to supply command bars.

Also related, you should make sure that every menu item has a unique .TAG
property. Event sinking in Word is based on the .TAG property.

Also, not sure from your post if you understand this, but you should not
have to recreate your menu items for every document that is opened. If the
template containing your custom menus is loaded as a global template (as
explained above) or is in Normal.dot (which really is a global template
too), the menu items will show up for all documents.
 
J

Jean-Guy Marcil

Sorry Paul, but I do not understand what you are talking about...

Paul Frenay said:
I am using a VB add-in to create an additional menu entry.
This works fine, but ONLY in the first document.

What first document? Where are the second, third, etc. documents coming
from?
In new documents (created from templates), the menus are still visible,

What templates? Many document created from the same tempalte? Individual
documents creatd from different tempaltes?
and they open and close interactively, but they don't execute. Clicking

What menus? How are they created? Are they part of the template, or are they
dynamically created in the Document_Open event? (Or Document_New)
them doesn't seem to evoke an event. The menu in document1 is not
affected.

Again, which menu?
I can make the New Menu work in the newer document by deleting and
recreating it, but then the instance in document1 degrades to passivity
!

??? An example would be nice here... How is the "New menu" in the "newer
document" different from the one from "document 1"? Are these documents all
based on the same template?
Apparently the menubars from normal.dot and other templates do not
merge correctly. Any tips?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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