Slang's Anti-Singularity
  • Slanghome
  • Slangblog
  • Slangpuzzles
    • CurrentPuzzles
    • ScholarPuzzle
    • PastPuzzles

Ribbon Wrestling and Wrangling

3/28/2012

0 Comments

 
I've been in my new digs for about a week or so, and my first and foremost task has been to migrate an "application" that I (mostly) wrote in MS Word 1997-2003 to work in a Windows 7/Office 2010 environment. On the whole, the migration is a smooth seamless process when it comes to processes in the code itself. VBA is VBA regardless of whether the base is 2003 or 2010. The issues start to arise when the time came to create the custom interfaces.

Back in the 2003 days, the way to get the specific functions in front of the user was through either:
  1. customizing the standard menu;
  2. customizing the standard toolbar(s);
  3. creating a new menu;
  4. creating a new toolbar;
As it turned out, I - and the others who worked the project over the years - did all four.

After migrating the templates and code forward to 2010, all the customizations we did still were there, but packaged in a god-awful "Add-Ins" tab (what was formerly known as a menu) at the end of the list of standard tabs. Yuck. Nobody in their right mind would think that an appropriate solution to put before the end user. I certainly couldn't do it in good conscience. So, I started poking around the web, looking for methods, instructions and tools that would help me to:
  • Eliminate the "Add-In" tab and get back to meaningful named tabs;
  • Get back to context sensitive tabs and functions based on document type (template) where only the one custom tab would be visible.
I must say, there really isn't a lot to choose from. And to make it worse, what is good to work with and useful doesn't play natively with 2010, and what is barely functional is what's needed to create 2010 ribbons. That is, unless you want to delve into the file structure itself, which I don't particularly want to.

Microsoft publishes an incredibly lame tool with the glib and catchy name of "Custom UI Editor for Microsoft Office" (hereafter to be known as CUIEMO) that is, well, functional, I guess. I picked it up here. It is needed downstream in my convoluted process. But for creating the ribbon from scratch, ugh. I really wouldn't like it.

The other tool I found is extremely useful, and intuitive. It's drawback is that it doesn't create native 2010 XML; it creates customUI.xml files rather than customUI14.xml files. The cool tool is an AddIn for Excel. Yes, Excel. To customize Word ribbons, I am using Excel. If nothing else, one must learn to be flexible when dealing with Microsoft products!

The AddIn is called the RibbonX Visual Designer, developed by Andy Pope, and is available from his website. Below are screen shots between the two tools. I'll let you choose which you think is more useful for designing your custom ribbon. 
Picture
Andy Pope's RibbonX Visual Designer
Picture
Custom UI Editor for Microsoft Office
Since one is useful for designing the ribbon and the other is necessary for creating the actual files necessary, I use the two in conjunction. Here's how.
  1. Open the file (.docm/.dotm) that needs a ribbon in CUIEMO.
  2. From the Insert Menu, select "Insert Office 2010 Custom UI Part."
  3. From the Insert Menu, select "Sample XML | Custom Tab." You should see some XML inserted. We'll be replacing that later with what you really want.
  4. If you want to add icons, select "Insert | Icons..." and add any images you want to be a part of the custom ribbon. Make note of the names, you'll need them later.
  5. Save and close.
  6. Open the .docm/.dotm in the RibbonX Visual Designer Interface.
  7. Customize to your heart's content. If you have decided to use any of the custom images you added to the file above, enter the name in the image property without the extension. If you want to use standard iconography, use the imageMso property.
  8. Click on the CustomUI XML tab.
  9. Select everything between the <ribbon> and </ribbon> tags and Copy.
  10. Save and close.
  11. Open CUIEMO again.
  12. Open the document.
  13. Select the text between the <ribbon> and </ribbon> tags and Paste.
  14. Click the Validate XML button to confirm nothing bad happened.
  15. Save and close. 

Your new ribbon is done! If you need to edit it again later, all you need to do is from Step 6 and beyond. Oh, all your callbacks are also automatically generated, so all you need to do is copy and paste those into your VBA code too. Of course, if you are comfortable simply writing XML code, you can either do it within the CUIEMO environment, but it really sucks with jumping around and flicker. Or you can use your favorite XML editor and copy/paste that too.

 Have at it. I hope this saves someone else the difficulty I had in getting to a functional, custom ribbon. 
0 Comments



Leave a Reply.

    RSS Feed

    Author

    Just a guy out exploring the world. Former world-class never-was endurance runner.

    ​Hit me up, and we'll catch a beer or coffee in your town.


    Follow @slang4201

    Archives

    August 2022
    July 2022
    June 2022
    May 2022
    April 2022
    March 2022
    February 2022
    January 2022
    December 2021
    November 2021
    October 2021
    September 2021
    August 2021
    May 2021
    October 2020
    September 2020
    December 2019
    November 2019
    October 2019
    July 2019
    October 2018
    September 2018
    May 2018
    April 2018
    November 2017
    October 2017
    July 2017
    June 2017
    June 2015
    August 2014
    January 2014
    October 2013
    September 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    November 2012
    October 2012
    September 2012
    August 2012
    July 2012
    June 2012
    May 2012
    April 2012
    March 2012
    February 2012
    January 2012
    December 2011
    November 2011
    October 2011
    August 2011
    March 2011
    October 2010
    July 2010
    January 2009
    December 2008
    October 2008

    Categories

    All
    2011
    Alfama
    Alternate Energy
    Android
    Angela Sullivan
    Animals
    Antiques
    Apple
    Ash Canyon
    Astronomy
    AT&T
    Australia 2022
    Bailout
    Battery
    Bicycling
    Biometrics
    Books
    Brisbane
    Cairns
    Canary Islands
    Carrier Iq
    Carson City
    Cascais
    Centennial
    C Hill
    C-Hill
    Christmas
    Climate
    Clothing
    Coding
    Colorado
    Columbus
    Cramps
    Curiosity
    Dad
    Dardanelles Lake
    Dell
    Dick's Lake
    Dilbert
    Diving
    Eagle Lake
    Earworms
    Eating Problems
    Eclipse
    Economy
    Ecuador
    Education
    Eldorado Canyon
    El Valle
    Energy
    Errors
    Espionage
    Europe 2019
    Evi
    Fallon
    Family
    Fontanillis Lake
    Food
    Gamboa
    Garmin
    Geocaching
    Goals
    Google
    Google Earth
    Grouse Lake
    Hiking
    Inov8
    Investing
    Ipad
    Iphone
    Iron Mountain
    Lanzarote
    Legislatures
    Lisbon
    Mac
    Market
    Market Drop
    Mars
    Mctarnahan
    Medicine
    Microsoft Word
    Motivation
    Mountain Biking
    Moving Minutes
    Music
    Nevada Day
    Nfc
    Ohio
    Olympics
    Openoffice
    Opportunity
    Panama 2018
    Panama 2022
    Paper Airplane
    People
    Playa Coronado
    Politics
    Portugal
    Prison Hill
    Privacy
    Puts
    Puzzles
    Quito
    Race
    Rant
    Reno
    Retrospective
    Roosevelt
    Running
    Running Dynamics
    Saddest Cities
    Safe & Sober
    Science
    Scuba
    Shoes
    Shopping
    Sicily
    Sierra
    Sierra Canyon
    Sintra
    Slangsploration
    Snl
    Soccer
    Software
    Spasms
    Spirit
    Sullivan Canyon
    Svn
    Tahoe
    Tahoe Rim Trail
    Taormina
    Taxes
    Technology
    Transit
    Travel
    Trees
    Vba
    Velma Lakes
    Venus
    Verizon
    Violin
    Watches
    Weather
    Wolframalpha
    Words
    Wrestling
    Writing
    Xkcd
    Yawbe
    Yoga

This is ALL MINE, I tell you! copyright 2010-2022