NotePad - Document Level


Creating an Excel Workbook with a Custom Ribbon

This ribbon customisation will only be visible when this particular workbook is open.
Create a new workbook and save it as a macro enabled workbook (WorkbookRibbon.xlsm)
Change the file extension of your workbook from (.xlsm) to (.zip)
Double click the zip file to open it as a compressed folder


Create customUI file and folder

Create a folder on your desktop called "customUI"
It is a good idea to put the ribbon XML component into its own folder as you might want to also include other files, such as button images.
Open notepad and create a file called "customUI.xml" in this folder
Copy and paste the xml tags below into this file and save the file

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> 
  <ribbon startFromScratch="true">
    <tabs>
      <tab id="CustomTab" label="My Tab">
        <group id="SimpleControls" label="My Group">
          <button id="Button1" imageMso="HappyFace" size="large"
            label="Large Button"
            onAction="ThisWorkbook.MyMacro"/>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Drag your customUI.xml file into the compressed folder


Modify the .rels file

Drag the _rels folder to the desktop
Open this folder and open the .rels file

Add the following line between the last < Relationship > element and the closing < Relationship > element

<Relationship Id="customUIRelID" Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility" 
Target="customUI/customUI.xml"/> 

This line creates a relationship between the workbook file and the customisation file.
Make sure you specify the folder and file names correctly (case sensitive)

Save and close the .rels file
Delete the _rels folder from the zip file.
Drag the .rels folder from your desktop into the zip file and close the zip file.


Save changes and open

Change the file extension of the (.zip) back to (.xlsm)
Double click the WorkbookRibbon.xlsm file


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext