No more fooling around trying to figure out what the idMso is for the built in Excel commands when you're trying to customize the Ribbon. There is a great little download available from Microsoft to add a group of galleries to the Developer tab on the Excel ribbon. So what's in the galleries? Check this out:
And when you click on a button, you get a little expansion like below:
Not too shabby! Finally there is an easy way to figure out the idMso for the built in commands, and browse all the images in an easy to use location. (Okay, granted, I just found it, and I'm sure it's been up for a while. 😉 ) The really good thing here is that you can see ALL the images, not just the ones that are on the menus. Not to mention that this is actually efficient. You don't actually have to click on the item to get the id!
As an FYI, you'll need to pass the Genuine Validation tests to download the file, but so long as you can, it's all good. It comes as an .exe file (go figure), that extracts an .xlsm file. (Excel Macro enabled workbook.)
The one change I made to this, based on the recommendations of a friend, was to save the file as an Excel add-in (.xlam). Once done, I installed it as an Add-in (Office menu|Excel Options|Add-ins|Go). I now have it available whenever I need it.
EDIT February 23, 2007:
Based on Zack's feedback, I thought I'd make this change as well. I added a textbox to the userform, and modified the onAction code to the following:
[vb]Sub OnAction(control As IRibbonControl, id As String, index As Integer)
If (control.Tag = "large") Then
id = Strings.Mid(id, 3)
Dim form As New ControlInfoForm
.nameX.Caption = "imageMso: "
.tbMso = id
Set .Image1.Picture = Application.CommandBars.GetImageMso(id, 16, 16)
Set .Image2.Picture = Application.CommandBars.GetImageMso(id, 32, 32)
The result of this, as Zack points out, allows us to easily copy the control name in case it's really long:
Another interesting thing here, though, is the code. Despite moving to the Ribbon for the Office 2007 UI, Microsoft still references the commandbars objects to get the images. I found that just a little surprising, as I'd assume that they would have abandoned it all together. Go figure!
Thanks for the ideas, Zack. 😉