Nov 21

On creating a custom ribbon UI XML definition in a VSTO project using Visual Studio 2010 with an Office 2010 edition you might run into trouble on testing your customized ribbon in Office 2007 as ribbon probably won’t include any custom tab or button at runtime without showing any error or similar. The issue is related to XML namespaces.

VSTO in Visual Studio 2010 is providing XML-based ribbon customization using a basic XML definition like this:

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns">
        <group id="MyGroup"
               label="My Group">
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

While this is working great in Office 2010 and did seem to work in selected installations of Office 2007 it still may fail to integrate your customized ribbon controls in other installations of Office 2007. To fix this, simply switch the namespace as the one used before isn’t properly registered with the latter installations.

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns">
        <group id="MyGroup"
               label="My Group">
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Mind the difference in second line of code.

Comments are closed.

preload preload preload