Using CustomUI Editor

If you are working with RibbonX code in Microsoft Office, you no doubt use the CustomUI editor from OpenXML Developer.

The tool has is an essential one for working with RibbonX and Office as it offers us the following advantages:

  • Much easier than manual adjustments to the Office file
  • A button to validate the XML for correctness
  • An easy way to import and rename pictures
  • A tool to generate callbacks with the correct syntax
  • Ability to generate sample XML code to start from

I will honestly say that I will not try to attempt to modify RibbonX code without it.

There is one thing that you need to be aware of, however, and that is the danger of overwriting your file by accident.

To modify your XML markup, you open your file in the CustomUI tool, edit it, and save it.  If you're anything like me, though, you then open it up in your application without closing the CustomUI file.  Why?  Because you have to ensure your controls are correctly referenced in VBA code and the spelling is important.

The danger of this is making updates to your XML.  If you've already added a ton of VBA code, saved the file (Excel workbook, Word doc, etc...) and exited it, well... no big deal.  The issue comes in if you edit the XML in the document that still sits open in your CustomUI editor, then save it.  *Poof!*  There goes the code you programmed.

It's like a copy of the file is opened in the CustomUI tool.  You can't overwrite the file until it's closed, but when you do, it's overwritten with the copy that is open in the CustomUI tool, not updated.

So, rule of thumb, if you are keeping the XML open to review, is to close the source file, then close and re-open the file showing in the CustomUI editor.

Hopefully it saves someone from re-writing a bunch of code.  🙂

8 thoughts on “Using CustomUI Editor

  1. Hi,

    I have added my own icons by using the Custom Editor.

    I would like to achieve the same in VSTO 2005 SE at the application level.

    Could let me know how do we do that? I tried as suggested in some blogs but its not working.

    Regards,
    Digambar.

  2. Hi All,
    I can create customUI for my workbooks and if I open those workbooks from windows then customUI appears just fine. However, when opening workbooks programmatically with "workbooks.open" my workbook opens without the customer UI. Everything reverts back to the basic Excel Toolbars etc.

    Thanks,
    Mark

  3. I was wondering, do you need to have Custom UI installed in other computers to use the tabs you have created? Or since oyu are tecnically changing the current ribbonx code then its all saved in the excel file?

  4. Hi Andres,

    No, not at all. The developer can use the CustomUI editor to make UI changes, but it's just a tool. You can actually do the same thing manually without the customUI editor if you know how. Once built though, the code remains in the workbook. At that point you can open the file on a PC without the CustomUI editor installed, and the code will still run. 🙂

  5. Thank you Mr. Ken. I wanted to ask you another question i dont know if you can direct me in the right direction. I am creating specific images for my buttons. Is there a way i can place these images inside the newly created CustomUI folder inside the excel file. That way whenever someone makes a copy of the excel file they dont have to also take an extra images folder. It would all be referenced from within the excel file. What path would i use for this?

Leave a Reply

Your email address will not be published. Required fields are marked *