• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1245
  • Last Modified:

Manually edit Excel RibbonX customisation

I have a lot of experience creating new ribbons to enhance the presentation of my Excel applications. I usually use the OpenXMLDeveloper 'Custom UI' tool (Click here). I am soon going to be working on a project were I will not be able to install the editor and so am looking at manually updating the 'CustomUI14.xml' file that contains the Ribbon XML.

I know of the internal file structure of the XLSX and XLSM files but the problem I am getting is that when I re-zip (with or without compression) the folder of the XML parts and try to open the file in Excel, I get the following 'Corrupt' error message. I am therefore unable to open the files I manually edit.

Error message : The file is 'corrupt'
Can anyone explain / suggest why ?
  • 2
2 Solutions
OK, you shouldn't be Re-zipping anything...

Just change the extension of the xlsm/xlsx to and from .zip to work on the custom UI
(I just add .zip to the existing and remove it when done)

Then copy the UI out of the zip folder, work on it, then paste it back in.

There should be no need to re-zip anything.

Also in the folder in the zip folder called _rels
Drag the .rels file to your desktop
Edit the .rels file using notepad or similar
Add the following the the rels file before the </Relationships> tag:
<Relationship Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility" Target="/customUI/customUI.xml" Id="12345" />
Then save the .rels file and pop it back into the zip file.
AL_XResearchAuthor Commented:
Thanks 'The_Barman' for your response.

I am confused in that case, because copying the UI out of the ZIP and pasting it back in is unzipping and zipping that file (even if no compression is applied). In my case I am using WinZip and dragging the file out of the archive window and back - but it is still performing the 'zip / unzip' action on that file.

I did however realise (inspired by your comment's confimation) of what error I had made. Basically I was:

1. Adding the ZIP extension to the XLSM

2. Extracting all files to a folder

Effectively just the same as extracting one file

3. Amending the file

Thanks - I know about the relationship links between files

4. Rezipping the containing folder

(with zero compression)

5. Removing the ZIP extension from the XLSM

It was step 4 that was the issue - I was automatically zipping up the folder. If you look at the contents of the file package you will see the '_rels' and 'customUI' et al folders at root level. When it zipped the folder it had the folder in the package at root level. In other words I had completly changed the internal structure of the package - no wonder it was corrupt !

Thanks for your help !
AL_XResearchAuthor Commented:
I had made a mistake when zipping up the parts of the OpenXML package, but 'The_Barman' helped trigger my finding the issue.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now