NotePad - Document Level


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.

microsoft excel docs

Create customUI folder

It is a good idea to put all your ribbon XML into its own dedicated folder.
Adding a custom ribbon that uses built-in images will be a single xml file.
If you want to include your own custom images these additional files should be placed in the same folder.
Create a folder on your desktop called "customUI".


Create customUI14 file

Open notepad and create a file called "customUI14.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 folder from your desktop into the compressed zip folder.

microsoft excel docs

Modify the .rels file

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

microsoft excel docs

Add the following line before the final </Relationships> tag.

<Relationship Id="customUIRelID" Type="http://schemas.microsoft.com/office/2007/relationships/ui/extensibility" 
Target="customUI/customUI14.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).

microsoft excel docs

Save and close the .rels file.
Delete the _rels folder from the compressed zip folder.
Drag the .rels folder from your desktop into the compressed zip folder 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.

microsoft excel docs

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