I have created a document level customisation in Excel that contains a ribbon and I would like to create an application level customisation for Excel which involves a ribbon of the same name. My problem is how do I get the two ribbon to combine? Currently, they have the same custom ControlId.
The idQ property of controls exists to enable multiple add-ins to share containers, such as custom tabs and groups.
In the following VBA example, two Excel add-ins share the same "Contoso" group on the add-ins tab; each adds one button to it. The key is specifying the same unique namespace in the tag. Then, controls can reference this namespace by using idQ.
CustomUI for add-in 1
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
xmlns:x="myNameSpace" >
<ribbon>
<tabs>
<tab idMso="TabAddIns">
<group idQ="x:Contoso" label="Contoso">
<button id="C1" label="Contoso Button 1" size="large"
imageMso="FileSave" onAction="c_action1" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
CustomUI for add-in 2
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
xmlns:x="myNameSpace" >
<ribbon>
<tabs>
<tab idMso="TabAddIns">
<group idQ="x:Contoso" label="Contoso">
<button id="C2" label="Contoso Button 2" size="large"
imageMso="FileSave" onAction="c_action2" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
If you use a COM add-in to customize the Fluent UI, the namespace name must be the ProgID of the COM add-in, but the behavior is otherwise the same. When you use a shared add-in, the ProgID is AddInName.Connect. When you use Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System (Visual Studio 2005 Tools for Office Second Edition) to create the add-in, the ProgID is the name of the add-in.
You can read more about the Fluent UI (aka Ribbon UI) in the following series of articles in MSDN: