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 ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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="" 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 !

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.