AJP Excel InformationAJP Excel Information
ChartsVBAFun stuffForumsTipsLinksBooksWhat's newContactAboutSearchRSS Feed

 
 
 

RibbonX Visual Designer

Although the add-in has been tested and create a backup file when used there is always the potential for an error to lead to the corruption of a workbook. Therefore I strongly recommend that you take your own copy of the file before using the designer.

Designer 

 The RibbonX Visual Designer is a VBA add-in designer to help with the construction of Ribbon interfaces. The add-in will now work with PowerPoint and Word files as well as Excel.
In order to construct and preview files in PowerPoint or Word the add-in will attempt to reference the correct version of the application. If you have versions prior to 2007 installed then you may need to manually open the relevent application before opening the designer or loading RibbonX. Under normal circumstances the correct version of the application will be opened if no instances are currently open. If you recieve the warning message simply save and close any open instances of the application before trying again. Obviously this is not an issue when working with Excel files.

When the add-in is loaded 2 new buttons will appear on the Developer Tab.

Designer Ribbon   

 

The Designer menu contains the Office Applications that can now be used.

Ribbon Designer Applications

I have also added a button to the Office Menu.

RibbonX Designer Office menu 

Download latest version of RibbonX Visual Designer [] (940KB)
Use the Load RibbonX to work with existing Excel files even if they do not currently contain ribbonx code. You can import, modify, preview and save the files ribbonx information.

Use the Designer to create, preview and save a new file with ribbonx information.

The program can handle
Excel:  .xlsx, .xlsm, .xltx, xltm, .xlam and .xlsb files
PowerPoint: .pptx, .pptm, .potx, .potm and .ppam files
Word: .docx, .docm, .dotx and .dotm files

Note:

In order for the RibbonX Visual Designer to modify a file it must check that the file is not currently open. This task requires access to the VBA Project object model.
Therefore you need to enable this property manually.

Use Office Button > Excel Options > Trust Center > Trust Center Settings > Macro settings.

 

With the designer loaded you can modify built-in items such as the visibility of a Tab or Group. Or more likely you can create your own custom interface.
To build you custom interface start by selecting the node that will act as the parent of the item you wish to add. 
So to add a new Tab [] select the Tabs node []in the Ribbon view. You can then select the Tab [] item from the toolbox and either double-click or use the Insert Item button [] to insert the new item. 

Properties
The details of the selected item in the Ribbon are displayed in the Properties list.
Load RibbonX allows you to import, modify, preview and eventually save a files existing ribbonx information.
Designer allows you to create, preview and eventually save a file with ribbonx information.
The program can handle .xlsx, .xlsm and .xlam workbooks.
With the designer loaded you can modify built-in items such as the visibility of a Tab or Group. Or more likely you can create your own custom interface.
To build you custom interface start by selecting the node that will act as the parent of the item you wish to add. 
So to add a new Tab [] select the Tabs node []in the Ribbon view. You can then select the Tab [] item from the toolbox and either double-click or use the Insert Item button [] to insert the new item. 

Properties
The details of the selected item in the Ribbon are displayed in the Properties list.
Each property is one of the following,
Dropdown list of predefined options. e.g. the size property can be normal or large; enabled property can be true or false.

Textbox where descriptive text or values can be entered. e.g. the label or supertip properties.

Mso Image selector for picking of built-in imageMso property. The size of images displayed will depend on the setting of the size property.



When selected a sub form will display available icons. The image size in the gallery is dependent upon the current setting of the size property.
On the sub form both the large and small icon is displayed for the selected icon.

Image file selector for picking custom image files. 



The add-in will display a viewer containing all existing imagery for the file. The Browse button can be used to add new images.

Image Viewer

Please note that if you are using .png graphics and callback routines to dynamically load files you will require additional coding routines to enable the loading of png files.

Fortunately Stephen Bullen has posted a file with the required codes. LoadPictureGDI

Callbacks
Available callbacks are displayed in the Callbacks list.

When you check the callback an automatic routine stub name is created. You can change this, if for example you are using a single callback routine to handle the same event across multiple items.
CustomUI XML
This is a read-only copy of the information that will be written to the file. 

Only for use if you want to manually maintain your files. You can copy this to the clipboard. 
Callback Stubs
This is a read-only copy of vba callbacks that you can copy and paste into your file.

The code does not include any additional variable declaration required to make the VBA function.
CustomUI Rel XML
This is a read-only copy of the xml required if you are using custom images.

Only for use if you want to manually maintain your files. You can copy this to the clipboard.
Moving custom items within the Ribbon.
As well as the Insert Item [] there are controls for moving and removing custom items within the Ribbon.
Delete Item [] will remove the selected item and all items contained within from the ribbon.
Move Item Up [] will move the selected item up, taking along all items contained within.
Move Item Down [] will move the selected item down, taking along all the items contained within. 
Demote Item [] will move the selected item within the item immediately below it, taking all the items contrained within.
Premote Item [] will move the selected item out of and below the containing item, taking all the items contained within.
Clone Item [Clone Item] will create a copy of the selected item and all the items within it.
All the properties and callbacks will be copied. The Id property will be a unique defalt value.
The these controls it is possible to nest items within each other. e.g buttons within menus, or Items within a Gallery.
All of the movement buttons will only perform the task if it is valid.
Controls
I have created a set of example files demonstrating the various controls that can be used on the ribbon. There are Excel, PowerPoint and Word versions.
Download ControlGallery [] (872KB)
Demonstrates the use of Button, Checkbox and Editbox.
Demonstrates the use of Combobox, Dialog launcher and Dropdown.
Demonstrates the use of custom images, Gallery and Dynamic Gallery.
Demonstrates the use of Menus, Split and Toggle buttons.
Demonstrates the use of Box, Button Group, Label and Separator formatting items.
 
Office Menu
You can also add ribbonx to the Office menu [].
This will result in a new item on the Office menu.

Download OfficeMenu [] (35KB)
Quick Access Toolbar
You can also create buttons and groups on the Quick Access Toolbar (QAT) []. 
Note this requires the setting he CustomUI property "StartFromScratch" to true.
Document controls will only appear when the specific workbook has focus.
Results in the following appearance of the ribbon. Note the borders around the icons which denote they are document specific.

Download QATDocument [] (33KB)
Shared Controls will be available to all open workbooks.

Results in the following appearance of the ribbon.
Download QATShared [] (26KB)
Contextual Tabs
It is possible to add tabs [] to existing Contextual Tabs [].

Results in the following appearance of the ribbon when a Chart or Chart object is selected
Download ContextualTabs [] (40KB)
Namespace
By using a namespace you can allow multiple files to share parts of the ribbon use customize.
The following screen shots show the properties of 2 workbooks with both private and shared sections of the ribbon.

Which results in the following appearance of the ribbon when NamespaceA.xlsm is active.
Which results in the following appearance of the ribbon when NamespaceB.xlsm is active.

Download Namespaces [] (64KB)
Command
By using the Command item you can repurpose the built-in function of buttons. The following repurposes the Bold button.

You need to define callback

Which will generate the following VBA stubs.

In the download file I have added a simple message box rxBold_repurpose routine.
Download Commands [] (44KB)

Download all Excel examples  [] (381KB)
Download all PowerPoint examples [] (559KB)
Download all Word examples  [] (410KB)

Download latest RibbonX Visual Designer [] (940KB)  
For instructions on how to install add-in
To replace existing add-in with later version you simply need to overwrite the existing add-in. Make sure Excel is not running otherwise you will not be able to replace the file.
Version History
  • Word and PowerPoint example files for ControlsPart3 has been amended slightly as the dynamic gallery was not populating when used with Office 2010
  • Version 1.93 December 2010
    • Bug fix Office Button menu entry points where not working
  • Version 1.92 April 2010
    • Added .xlsb file type
  • Version 1.91 February 2010
    • Bug fix when handling incorrect application version for PowerPoint and Word
    • Bug fix for handling image formats not supported by VBA controls that maybe valid for use in the ribbon
  • Version 1.9 January 2010
    • Added PowerPoint and Word capabilities
    • Added Image viewer for working with existing custom images
  • Version 1.7 December 2009
    • Bug fixed to allow reloading of formatted built-in groups
  • Version 1.6 October 2009
    • Added OnAction callback to Dropdown control
    • Added check for Trusted Access to VBA Project
  • Version 1.5 September 2009
    • Addition of entry points within Office menu
    • Correction to handling of positioned controls

This Addin uses routines and techniques provided by the following.
Jan Karel Pieterse (www.jkp-ads.com)
JKP Application Development Services©
Class to Edit XML office file
Ron de Bruin (www.rondebruin.nl)
Zip file creation

Ron also has a great collection of Ribbon related articles.
Ken Puls (www.excelguru.ca)
Additional coding to the XML class for the customUI relationship to the rels file.
Randy Birch (http://vbnet.mvps.org/index.html)
UNC file functions
I also made extensive use of the RibbonX book Customizing the Office 2007 Ribbon By Robert Martin, Ken Puls, Teresa Hennig
Including trying all the example download files.

The following error messages may be encountered if you do not have the required libraries registered on your pc.

"Can't find project or library" or

"Cannot run the macro btnLoadFile_click. The macro may not be available in this workbook or macros maybe disabled"

The 2nd error is of course possible if Macros are not enabled.

Libraries

  • Visual Basic For Applications
  • Microsoft Excel 12.0 Object Library
  • OLE Automation Microsoft Office 12.0
  • Object Library Microsoft Forms 2.0
  • Object Library Microsoft Windows Common Controls 6.0 (SP6)
  • Microsoft XML, v3.0
  • Microsoft Word 12.0 Object Library
  • Microsoft PowerPoint 12.0 Object Library

The add-in will not function in Excel 64-bit.
Due to certain 32-bit controls not being available in 64-bit versions.
   
 
Alternative links

 

   

Last updated 28th December 2012

 
 
  Home | Charts | VBA Code | Fun Stuff
Forum Examples | Tips | Links | What's New | Book List
Contact | About
Microsoft® and Microsoft® Excel are registered trademarks of the Microsoft Corporation.
andypope.info is not associated with Microsoft. Copyright ©2007-2012 Andy Pope