UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Ribbon-helper (helper Classes To Speed Up Ribbon Development), Access 2013    
 
   
jamiew
post Oct 10 2014, 01:25 AM
Post#1



Posts: 48
Joined: 29-July 12
From: Southern California


Hi Everyone,
This post is to debut a project I have been working to support building and designing Ribbon UI's in Office. The goal is to create support classes that work across Office applications that allow for quick, easy, and fun development of the ribbon ui.
Try it out
Currently, Ribbon-Helper will work with Access, Excel, PowerPoint, and Word. However, for the purpose of this post I will only be discussing Access. When you download this post, in the Examples folder, you will find Ribbon-Helper.accdb. I have already loaded a sample ribbon in the USysRibbons table and set it as the default ribbon when Access loads. I have also set the startFromScratch property to true, so you will only see the example ribbon and none of the other default tabs. Open up the Visual Basic editor window (Ctrl+G) or click on the Visual Basic tab and click on the Visual Basic button. In the intermediate window, type 'Run'. This will call a procedure in the basExamples module that will run through code examples that set and change the ribbon controls. This module is where you will want to see how the Ribbon-Helper is called and then try it out in the intermediate window or other procedures that you'll create yourself.
Example
CODE
' A button
Ribbon.Button("ButtonExample").Label = "I am a button"
' A dropdown
Ribbon.DropDown("DropDownExample").Item("Item1").Label = "I am an item"

Requirements
In order to use, you will need to follow some rules when building your own xml for the ribbon. First, all control names must be unique. This is a requirement for any particular ribbon by default, but with Access you can load and use multiple ribbons at the same time, so control names must remain unique across all ribbons. Without getting too far into the details, the reason for this is that all controls are loaded into the same collection object.
Second, all control names need to be prefixed with the name of the control type. For instance in order to use a button, you would need to name the button in your xml "ButtonClickMe." A toggle button would be "ToggleButtonPressMe." Pretty simple right? The for this is because when the ribbon loads the xml you've provided, it does not return the control type for a given control. So having the control type prefixed in the name, we can properly classify the control type and associate it with the correct set of classes.
If you want to use this in your own project, just copy all of the code modules into your project, and just check to make sure there is a reference to the Office Object Library for the version of Office you are using.
I've included an started xml file to use as a base if you would like to develop your own ribbon, just remember to add it to your USysRibbons table. There is a lot more that I need to write in terms of how it works, and working with the code. But I have been working hard at it for a while and would love any feedback regarding its use, especially in Office 2007, 2010, and 2013.
This is still in development and I will continue to update this post and files as I make progress, I hope to make this project a resource that helps Access users build ribbons and have fun doing it.
Attached File(s)
Attached File  Ribbon_Helper.zip ( 1.99MB )Number of downloads: 167
 
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    13th December 2017 - 07:26 PM