How to make ribbon have different buttons enabled in different workbooks? - excel

There is only one ribbon object in the add-in, so it's shared between all workbooks. How I can make different ribbon buttons enabled in different workbooks?

I assume you are talking about Ribbon XML as the designer tries to make it seem like the ribbon is more based on the document.
If you are using Ribbon XML as I suspect, then this is very difficult and I would suggest two options. Either switch to the Ribbon Designer, which you can handle the Loaded and other events and set the .Enabled property on the button controls. Or give http://vstocontrib.codeplex.com/ a go, it is designed to make this scenario much easier. Have a read of the doco around the Ribbon Factory.

Related

Add combo box in OfficeJS Excel

I am developing an add-in with Office JS, In need add combobox when click in a bottom but I dont see this options it is possible
add combobox with OfficeJS
Combo boxes are not supported in OfficeJS for ribbon customizations. Supported control types are:
Simple buttons - trigger specific actions.
Menus - simple menu dropdown with buttons that trigger actions.
Read more about ribbon customizations in the Add-in commands for Excel, PowerPoint, and Word article.
But you may consider creating a task pane with any controls. There are not limitations on the controls used for task panes (unlike ribbon).
Remember that you can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team go through the planning process.

How to avoid the ribbon groups to be changed by a dropdown button

I have this ribbon defined in my VSTO addin for Excel:
When I run the application in a narrow monitor, the ribbon appears like this:
How to avoid the groups to be changed by a drop down button? If I decrease window width, default ribbon groups are not changed, only my custom groups, so I am pretty sure it is possible.
I have read something about "autoScale" property in XML, but I am not sure how to apply that in my case.
Thanks
Jaime

Sendkeys to the right custom Excel ribbon

I'm working with a custom Excel add-in that unfortunately doesn't expose its functions to VBA, so I'm resorting to a SendKeys approach (see picture). Excel assigns Y1 to the Help ribbon, and all the other custom add-ins get assigned Y2, Y3, etc. Thankfully, it looks like these shortcut keys are consistent internationally (Japan, LatAm).
The issue is that depending on the installation order, custom ribbons will get assigned a different shortcut key for different users.
I'm looking for a way to identify the position of "DataFlow" ribbon in Excel so I can SendKeys to the right ribbon. Thanks in advance!
The Excel extensibility model doesn't provide anything for that. You can try using the Microsoft Active Accessibility technology to identify where tab controls are located and their properties.
The Fluent UI provides the IRibboUI.ActivateTab method which activates the specified custom tab. You just need to specify the identifier of the custom Ribbon tab to be activated.

Excel Form Controls Don’t Have Properties

Why is there no way to access Excel’s Form Controls properties? In Design Mode when, for e.g. button is right-clicked, the only options that pop-up are:
Cut
Copy
Paste
Edit Text
Grouping
Order
Assign Macro
Format Control
When clicking on Properties under Controls on the Developer tab, the only control that appears in the drop down is Sheet1 Worksheet.
Is there a setting that needs enabling or am I forced to use an ActiveX Control?
If you want those properties, you have to use ActiveX. Form controls are designed to be simpler, but with fewer options, like properties and events. Form controls still have properties, just not as many and you can't access them from a property sheet like first class Excel objects. You can still manipulate them through the UI and through VBA.

VSTO - How to make Ribbon buttons to fill vertically the blank space

I'm building a VSTO excel application, using Visual Studio 2013. I have one Large sized Ribbon button in one column, next to two Regular sized in another column. What I want is to fill the vertical space in the regular buttons column equally.
To see an example of what I want to do, see the "Calculation" group of "FORMULAS" tab in excel. My regular buttons are stacking on the top, but i want them to fill the empty space just like the "Calculate Now" and the "Calculate Sheet" are doing in this ribbon.
How do I do this?
Thanks.
The Fluent UI doesn't provide any property or attribute for that.
Read more about the Fluent UI (Ribbon UI) in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
Not all features (controls) are available for external developers.
I'm not sure if you will be able to do this. I was also looking for this but didn't find a solution. The ribbon is limited for programmers in certain features, for example you cannot make a menu with headers (like the insert chart in excel) or in ribbon galleries (like the chart styles),... I think this button fill is also one of these features.

Resources