You are here:

Excel/Ribbon identifiers for Solver

Advertisement


Question
Could you please help me identify the ID for the Solver add-in button and the group ID for the Analysis group in the Data tab in the ribbon in Excel 2010?

My reason for looking for the ID is that I would like to specify an onAction callback using XML in the customUI.xml file (google "Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)" and/or "Change the Ribbon in Excel 2007 or Excel 2010" for more info on what I hope to do).

My goal is to allow my own VBA code to run when a user selects the Solver button in a protected worksheet (normally Solver can't be run in a protected worksheet). My own VBA code would un-protect the worksheet, run Solver, then re-protect the worksheet. I know disabling/enabling protection like this isn't fool-proof, but for my needs, it's better than nothing.

As an example of what I hope to do, using the "Custom UI Editor for Microsoft Office", I can specify customUI.XML like this:
<customUI xmlns="I CAN'T INCLUDE LINKS HERE, BUT IT'S THE STANDARD URL">
   <commands>
       <command
         idMso="Cut"
         enabled="true"
         onAction="ThisWorkbook.MyMacro"
         />
   </commands>
</customUI>

This creates a callback so that when a user selects the Cut button in the ribbon, my own macro is called instead of using the normal cut functionality. Is there some sort of id / idMso that I can specify that would allow me to override Solver's normal functionality via a customUI.XML like the above? Also, I'm not sure it's a command element that would be used in the XML. Maybe a button element? Maybe a control element?

I didn't see anything Solver-related in the list of Microsoft ribbon elements (google "Office 2010 Help Files: Office Fluent User Interface Control Identifiers"). Is there a tool that reverse-engineers the list of MS and third-party commands / controls / elements within the ribbon? I have tried RibbonX, but it seems like that is not intended for this purpose.

Thank you for your help!

Answer
Hi Ed,

Your question has turned out to be quite challenging.  It appears that Microsoft has made it very difficult to ascertain IDs for add-in buttons. I just want you to know at this point that I'm not giving up but it may take longer, especially as I have other questions to answer as well. I don't have Excel 2010, but I believe the IDs are the same for 2007 and hopefully can find them. I will follow up when I have an answer.

Damon

Hi again Ed,

It just occurred to me to suggest in the meantime to create a custom Solver button on the Quick Access Toolbar.  You could write a macro that calls the Solver add-in components directly and call it from this custom button.  And of course you could un-protect and re-protect the sheet in this macro.

Damon
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Damon Ostrander

Expertise

I have extensive experience with VBA programming in Excel 5 through Excel 2013. As a former aerospace engineer with a large aerospace corporation and consultant in a small defense technology services company, I have developed a wide range of applications in VBA, including simulations involving mixed-language programming, satellite orbit mechanics, graphics and animation, and real-time applications. I am interested in moderate to hard VBA-related questions only.

Experience

I have developed and taught several courses in Excel VBA programming and also VBA programming in Office 97, 2000, and 2007. I have developed a number of large technical applications in Excel VBA for use within the aerospace industry.

Education/Credentials
B.S. in Electrical Engineering and Computer Science, University of California, Berkeley.

©2016 About.com. All rights reserved.