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.

alt text

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.

alt text

Modify the .rels file

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

alt text

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).

alt text

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.

alt text

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