PDA

View Full Version : More than one Customui



mcramer
07-12-2010, 11:02 AM
I have two Word 2010 templates, each of which adds a tab to the ribbon. They work fine separately, but when both are loaded, they don't work. One interferes with the other. Pressing a button on one runs code from the other template.

I've verified that the control ids do not duplicate each other and the macros they callback have different names.

Is there any way to have two customui files in place at the same time? Or alternatively, is there a way to disable the current customui and run the second one?

Paul_Hossler
07-13-2010, 03:43 PM
I've had 2 2007 documents loaded without conflicts.

Can you load documents from each of the templates, or post the XML?

The first thing is to see if you're assuming the wrong document is active, and your code runs on ActiveDocument which might be the Other Document

Paul

mcramer
07-13-2010, 04:52 PM
I've done a little more testing and I've discovered the following. The problem arises when one of the two templates with a customized ribbon is loaded as a global template (in Word's startup directory.)

The global template ribbon works fine, until a document is created from the second template. At that point, clicking on a button on a custom tab in the global template's ribbon produces the same result as clicking on the button in the second template's customized ribbon.

You can try this with the two attached templates.

They work fine on their own. This seems to be a bug in Word 2010.

mcramer
07-22-2010, 05:41 PM
I've solved this issue. In the two different templates that loaded the different tabs, I had a sub with the same name (that handled the button clicks.) Changing the name of one of them fixed it.

Bob Phillips
07-23-2010, 03:45 AM
http://www.excelguru.ca/blog/2009/06/17/debugging-ribbonx-invalidateinvalidatecontrol-failures%E2%80%A6/