My First Ribbon

Without further ado:

<customui xmlns=“http://schemas.microsoft.com/office/2006/01/customui”>
    <ribbon>
        <tabs>
            <tab idMso=“TabHome”>
                <group idMso=“GroupClipboard” visible=“false” />
            </tab>
        </tabs>
    </ribbon>
</customui>

I’m finally working my way through this book:

OK, so here’s my initial impressions. Initial, mind you. I do a tiny bit of xml coding and I’m able to disable the cut-copy-paste triumvirate without VBA. In addition, the Ribbon changes based on the active workbook. When my template is active, the Clipboard group disappears. When I activate a different workbook, it comes back. This is good. I can eliminate half of my Windows_Activate and Windows_Deactivate events because the “toolbars” take care of themselves. I’m sure I’m missing something, but this seems like quite an improvement to me.

But it’s not all puppies and kittens. Ideally I’d like to just disable the controls rather than hide the whole group. My problem is that I don’t know the idMso attribute for the controls. I found this list of control IDs but I haven’t downloaded it yet.

As a developer (not a user), my first impression of the Ribbon is a good one. I fully expect it to turn sour and that’s where you come in. For instance, I hear that it’s nearly impossible to truly disable everything Ribbon. I don’t create dictator apps, so I’m not sure how this is going to effect me. Yet, I know it will somehow. If you have a particular gripe about the Ribbon, from a developer’s perspective, I’d like to hear it. It will help me prepare for the inevitable.

Posted in Uncategorized

43 thoughts on “My First Ribbon

  1. So far, I’ve only had one bit of client work in Excel 2007 which did not involve only a UI redesign to accommodate the ribbon. I’ve done probably eight or ten projects (not counting my own utilities) using RibbonX. I have to say that it’s not as hard as I’d expected to modify, and it does have some interesting capabilities, but the fact that it cannot be done by the user through the UI nor completely through VBA makes it less flexible than it may have been.

  2. As long as you can hardcode things, ribbon work is pretty easy and quite powerful. Real pain hits you the minute you want something dynamic, like contextual, interactive or multilingual. Not impossible, but extremely awkward.

    But this is version 1. You guys probably have v2 any minute now. I’m sure it’s going to be great.

  3. For those of us who work with VSTO (and targeting Excel) we use the Visual Designer to build customized Ribbon UI solutions (in a snap). The tool can also generate the basic code for the Ribbon UI solutions.

    If we compare it with the Office 2007 Custom UI editor then the later is really poor.

    If we define Excel as a presentation layer then the present Ribbon X version is actually OK.

    If we define Excel as a work layer then it’s obvious that we lack the dynamic alternatives with the present version of RibbonX. It would be great if we can get some new APIs when 14 is shipped.

    The workarounds include:
    Load all the Ribbon UI customization into the cache when Excel is loaded.
    Use events controling add-ins as well as Custom Task Panes (application-level) or Action Task Panes (workbook-level)to get the operations executed.

    The book You refer to is the bible about RibbonX. It got some shortcomings but overall it’s a good source to learn from.

    Kind regards,
    Dennis

  4. Dick

    The book is great, i’d think that wouldn’t I? but I have an excel specific write up that may get you going on my blog here. (I did four parts but never did get around to the fifth).

    http://excelusergroup.org/blogs/nickhodge/archive/2008/01/30/ribbon-step-by-step-part-1-file-formats.aspx

    There are also some comments answered which may help some folk.

    I also have a Ribbon download here (including control names and IDs)

    http://excelusergroup.org/media/p/212.aspx

    Just in case it helps some.

  5. Dennis, I went into VS 2008 last night and created a 2007 VSTO workbook that responds to application-level events. I published it and was actually able to install it on another computer – including Net Framework 3.5 – with the push of a (couple of) buttons.

    It was fun, and I like programming in the VS environment, so thanks for the inspiration. I’ll start messing with events and the ribbon combined and see what I can do.

  6. Two questions: Why doesn’t the Custom UI Editor have a recently used file list? And why doesn’t this work:

    <customui xmlns=“http://schemas.microsoft.com/office/2006/01/customui”>
        <ribbon>
            <tabs>
                <tab idMso=“TabHome”>
                    <group idMso=“GroupClipboard”   >
                        <button idMso=“Paste” enabled=“false” />
                        <menu idMso=“PasteMenu” >
                            <button idMso=“PasteFormulas” enabled=“false” />
                            <button idMso=“PasteNoBorders” enabled=“false” />
                            <button idMso=“PasteTranspose” enabled=“false” />
                            <button idMso=“PasteLink” enabled=“false” />
                            <button idMso=“PasteSpecialDialog” enabled=“false” />
                            <button idMso=“PasteAsHyperlink” enabled=“false” />
                            <button idMso=“PasteAsPictureMenu” enabled=“false” />
                            <button idMso=“CopyAsPicture” enabled=“false” />
                            <button idMso=“PasteAsPicture” enabled=“false” />
                            <button idMso=“PastePictureLink” enabled=“false” />
                        </menu>
                        <button idMso=“Cut” enabled=“false” />
                        <control idMso=“FormatPainter” enabled=“false” />
                        <button idMso=“ShowClipboard” enabled=“false” />
                    </group>
                </tab>
            </tabs>
        </ribbon>
    </customui>
  7. How do I post the ribbonx Dick ?

    >Ron and Nick: Where did you guys get those idMso values? No offense to your >fine spreadsheet

    I start with the MS workbook and add screenshots of the groups and
    add a advanced filter option to the workbook to make it easy.
    This page is also easy now to find the names
    http://www.rondebruin.nl/xmlribbongroups.htm

    If you customize the QAT you can see the IdMso when point to the command in the
    “Commands Not in the Ribbon” list with your mouse and you see the name.
    See a screenshot on this page
    http://www.rondebruin.nl/notinribbon.htm

  8. “Why doesn’t the Custom UI Editor have a recently used file list?”

    The Custom UI Editor really seems to be just a simple toy someone put together for their own use, without thoughts of wider distribution. It has a number of funky behaviors that I don’t care for. But it is much easier than mucking directly with the XML parts of the workbook.

  9. Ron: Use this format

    [xml]ribbon stuff goes here[/xml]

    RE QAT: Good tip, thanks.

    Re dick.txt: Command huh? I’ll have to read that chapter and see what that’s all about. One distinction: I intend to keep Paste Values enabled. I want to allow the user to Copy and Paste Values, but nothing else to preserve my fine formatting. If I disable the whole PasteMenu that wouldn’t work, I think.

    Thanks for your help.

  10. Jon: Yeah, it seems so, but like you say it’s really convenient compared to working in the zip file. All I want is an MRU and a tabbed interface for multiple documents. I’m sure Ron will build one in his spare time. :)

  11. Hi Dick

    I think I like this

    <!– Set visible to false for the Clipboard group on the Home tab–>
     
       

    <!– Point to the Built-in tab to the ribbon –>
     

    <!– Add Clipboard group –>

    >I’m sure Ron will build one in his spare time
    What is that ?

  12. A test of posting xml

    <customui xmlns=“http://schemas.microsoft.com/office/2006/01/customui”>

    <commands>

    <command idMso=“Paste” enabled=“false” /> <command idMso=“PasteFormulas” enabled=“false” /> <command idMso=“PasteNoBorders” enabled=“false” /> <command idMso=“PasteTranspose” enabled=“false” /> <command idMso=“PasteLink” enabled=“false” /> <command idMso=“PasteSpecialDialog” enabled=“false” /> <command idMso=“PasteAsHyperlink” enabled=“false” /> <command idMso=“PasteAsPictureMenu” enabled=“false” /> <command idMso=“CopyAsPicture” enabled=“false” /> <command idMso=“PasteAsPicture” enabled=“false” /> <command idMso=“PastePictureLink” enabled=“false” />

    <command idMso=“Cut” enabled=“false” />
    <command idMso=“FormatPainter” enabled=“false” /> <command idMso=“ShowClipboard” enabled=“false” />

    </commands>

    </customui>

  13. My First Ribbon….oops De-Ribbon – Stored in an Addin File

    VBA Code For Classic Menus – Inspired from Andrews Blog – Modified to a Table Approach

    Sub Auto_Open()
    ShowClassicMenus
    End Sub

    Private Sub ShowClassicMenus()
    On Error Resume Next
    Dim cBar As CommandBar
    Dim cBarCtrl As CommandBarControl
    Dim sMenuName As String
    Dim sToolbarName As String
    Dim iMenu As Integer
    Dim c As Range
    Dim btnType As Long
    Dim Ctr As Long

    sMenuName = “Excel2003 Menu”
    sToolbarName = “Excel2003 Toolbar”

    CommandBars(sMenuName).Delete

    Set cBar = CommandBars.Add(sMenuName, , , True)

    With cBar

    .Visible = True
    For iMenu = 1 To 6
    Set cBarCtrl = .Controls.Add(Type:=msoControlPopup, ID:=30001 + iMenu)
    Next iMenu
    Set cBarCtrl = .Controls.Add(Type:=msoControlPopup, ID:=30011)
    Set cBarCtrl = .Controls.Add(Type:=msoControlPopup, ID:=30009)
    Set cBarCtrl = .Controls.Add(Type:=msoControlPopup, ID:=30010)
    Set cBarCtrl = .Controls.Add(Type:=msoControlPopup, ID:=30022)
    Set cBarCtrl = .Controls.Add(Type:=msoControlPopup, ID:=30177)
    Set cBarCtrl = .Controls.Add(Type:=msoControlPopup, ID:=30101)
    cBarCtrl.Caption = “ExtData”

    End With

    CommandBars(sToolbarName).Delete

    Set cBar = CommandBars.Add(sToolbarName, , , True)

    With cBar

    .Visible = True
    Ctr = 1
    ‘ID -Dynamic name for column containing Excel 2003 Button ID’s
    ‘For some reason Only Type 1 (Button) and Type 4 (Button ComboBox) are allowed
    ‘Also for Some reason the Close button, Addin Button etc – Cant have a button Image
    ‘ The paste button with a drop down also cant be added

    For Each c In Workbooks(“Classic_Menus.xlsm”).Names(“ID”).RefersToRange
    btnType = c.Offset(0, 2).Value

    Set cBarCtrl = .Controls.Add(Type:=btnType, ID:=c.Value)
    With Application.CommandBars(sToolbarName).Controls
    .Item(Ctr).FaceId = c.Offset(0, 1).Value
    .Item(Ctr).Caption = c.Offset(0, -1).Value

    End With

    Ctr = Ctr + 1

    Next c
    End With

    Set cBar = Nothing
    Set cBarCtrl = Nothing

    On Error GoTo 0
    End Sub

    The above, plus a heavily customised QAT….And Every thing fine with the universe again :-)

    The next challage is how to get the menus on a seperate Tab rather than on the Addins Tab…any ideas..

  14. cant get the XML….customUI xmlns=”http://schemas.microsoft.com/office/2006/01/customui”>
    ribbon>
    tabs>
    tab idMso=”TabHome” visible=”false”/>
    tab idMso=”TabInsert” visible=”false”/>
    tab idMso=”TabPageLayoutExcel” visible=”false”/>
    tab idMso=”TabFormulas” visible=”false”/>
    tab idMso=”TabData” visible=”false”/>
    tab idMso=”TabReview” visible=”false”/>
    tab idMso=”TabView” visible=”false”/>
    tab idMso=”TabDeveloper” visible=”false”/>
    /tabs>
    /ribbon>
    /customUI>

  15. Charlie….

    Thanks a Ton for sharing the files….It truely solves the Ribbon Problem..
    I can finally make the switch

  16. Ron –

    Some people are reluctant to switch away from something they are comfortable with. I am reluctant to switch to something that is inherently less effective.

    Why is the Excel 2007 ribbon less effective? The Excel 2007 Home tab contains 42 controls. In about the same space (actually less space), my customized Excel 2003 toolbars have 126 controls. My custom controls are visible all the time; I don’t have to hide some to show others. I can move my custom toolbars to places where they’d be more useful. I can change them through the UI. I get at least 18 distinct tear-away palettes in Excel 2003 so I can drag a palette where I want it, and access a selection in one click instead of a minimum of two.

  17. Ron –

    [b]WHAT JON SAID!!![/b]

    I spend as much time in Excel as anyone I know, and since last April or so when I bought my new laptop about a third of that has been under XL07, and two-thirds under XL03. That work has included a good range from penny-ante stuff (formatting lists, minor analysis) to some pretty sophisticated work (a power plant economic dispatch model that requires a tonne of logic to calculate dispatch and includes VBA to control model output). I know Excel well; not as well as some of the people here – but let’s face it, this little part of the internet probably represents the top millicile or so (if that’s a word) of Excel users – and I don’t think acceptance of an interface is necessarily tied to application expertise.

    I have [i]tried[/i] to use the Ribbon (not like I have much choice) – and I frickin’ hate it. My reaction to the Ribbon is not for want of trying, or want of experience with the damned thing – it’s because it is fundamentally flawed; it’s a bad product that represents the triumph of bafflegab and change for the sake of change over careful design. Microsoft has, for no particularly good reason, determined to [i]encrypt[/i] their interface. Other than the Ribbon (and the graphing module, which has taken a large step backwards), I quite like XL03. The Ribbon isn’t up there with “New Coke” – but it easily runs along with “Clippy” and the “Bob” user interface. The guy in charge of the project should be fired.

  18. OH – so I take it VBA tags use square brackets, but the html tags use angle brackets? I should have read more carefully before I changed all my angles for squares!
    ;)

  19. Charlie: I have a couple of harcore excel user collueges that still struggle finding things on the ribbon. You solution made them extatic. Thank you.

  20. Where is the XML for an Excel ribbon stored? I’d like to look at it and know where to manually alter the file if needed. The 2007 Custom UI Editor is decent but I want to know where to find the file itself.

    In Access it is stored in a system table called USysRibbons, is there an equivalent for excel?

    Great site, just found you!

  21. The XML is stored within the file. The file is really a zip file of many component files, so take a copy, change the extension to .zip and open it in a good zip application.

    In the zip file you will see a directory hierarchy, one of which is customUI. In there is a file called customUI.xml, where the ribbon XML is stored.

  22. This message is for Dcardno. You mentioned economic dispatch..I’d be very interested to get n touch with you. I’m trying to pick this stuff up…and i’m not an engineer. It’s very hard, but very interesting too..if you get a chance, pls shoot me a mail at chet_Dutts@yahoo.com.

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *