Office Custom UI: customization ignored and Error detected in XML ... 0x80070057 incorrect parameter

0

I tried to customize the Office ribbon for one of my Office documents, as explained in chapter "To customize the Fluent UI by using Office Open XML Formats files".

It should theoretically add a new tab and one button, but when I open this document I always get this error (NB: I activated the Office option to see errors with Backstage view (File) > Options > Advanced Options > General > Show add-in user interface errors):

Error detected in custom UI XML code ... Line 1 Column ... Error code 0x80070057 - Incorrect parameter.

Here is the popup containing the error message (NB: I have Office in French language):
Error detected in custom UI XML code (French)

And the new tab does not show up at all.

It failed with an Excel document, but I also tried to do it with Word and PowerPoint, and got exactly the same error.

Here are the changes I did to Classeur1.xlsx to add the tab (renaming its suffix to .zip, manipulating its content, and renaming it back to .xlsx):

  • In _rels/.rels, I added this line before added this line before </Relationships>:
    <Relationship Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"
         Target="customUI/customUI.xml" Id="customUIRelID"/>
    
  • I created customUI/customUI.xml:
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
      <ribbon>
        <tabs>
          <tab id="MyTab" label="My Tab">
            <group id="MyGroup" label="My Group">
              <button id="MyButton" label="MyButton" onAction="MyMacro"/>
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
    

NB: I know that the subroutine "MyMacro" must also be created and the Excel file is to be saved as type .xlsm, but I just want to propose the minimal case to reproduce, clicking the button is not the problem here.

My Excel, Word and PowerPoint versions: Office 365, Version 2008 (build 13127.20408 Office "click-and-go").

EDIT: here is the screenshot of version (NB: 2 days after my question, it has been upgraded automatically to version 2009 Build 13231.20262), and I haven't got the error now
Office subscription 365 PowerPoint version 2009Office subscription 365 PowerPoint version 2009

excel
powerpoint
ms-office
ribbon
word
asked on Stack Overflow Oct 4, 2020 by Sandra Rossi • edited Oct 7, 2020 by Sandra Rossi

1 Answer

0

The error is that <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> is not valid for the version "2008" for subscription 365 -- I don't pretend that it's Office 2008, it's just what I saw, it's like now "2009" (see screenshot in my question) -- even if Steve Rindsberg doubts that versions 2008 and 2009 can appear, sorry to not have taken a screenshot -- hopefully I could find this screenshot mentioning a version "2008" in this Windows blog post:
windows office with version 2008 !?

Instead, I used the namespace <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> combined with relationship using the Relationship namespace http://schemas.microsoft.com/office/2006/relationships/ui/extensibility>:

  <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon>
      <tabs>
        <tab id="MyTab" label="My Tab">
          <group id="MyGroup" label="My Group">
            <button id="MyButton" label="MyButton" onAction="MyMacro"/>
          </group>
        </tab>
      </tabs>
    </ribbon>
  </customUI>

Now, I can successfully see "my tab" when I open Classeur1.xlsx:
New custom tab in Excel ribbon

Reason

Ron de Bruin mentioned at https://rondebruin.nl/win/s2/win001.htm, while presenting the Office RibbonX Editor, that one of the two versions must be selected:

  • Insert Office 2010+ Custom UI Part
  • Insert Office 2007 Custom UI Part

So I guess that there is a corresponding namespace according to the Office version (whatever it's under 365 subscription or not). Note that there is also a different namespace for _rels\.rels mentioned in [MS-CUSTOMUI] and [MS-CUSTOMUI2] Microsoft standards.

  • 2010+ ([MS-CUSTOMUI2])
    • custom UI: <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    • Source relationship: http://schemas.microsoft.com/office/2007/relationships/ui/extensibility
  • 2007-2009 ([MS-CUSTOMUI])
    • custom UI: <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    • Source relationship: http://schemas.microsoft.com/office/2006/relationships/ui/extensibility

(*) PS: I am not sure to have correctly tested if the combination of both namespaces for 2010 did work or not for my version "2008" with subscription 365. Steve has said in the comments that it should have worked because it's subscription 365. I can't test anymore for "2008" because my Office version was automatically upgraded to version 2009, and 2010 namespaces work.

answered on Stack Overflow Oct 4, 2020 by Sandra Rossi • edited Oct 8, 2020 by Sandra Rossi

User contributions licensed under CC BY-SA 3.0