Accessing at Run Time

In Visual Studio 2010 it is possible to show, hide and modify the Ribbon dynamically.
It is also possible to call the ribbon code from custom task panes and action panes.
This applies to both document level and application level.



Is the Ribbon Visible
vis = CommandBars("Ribbon").Visible
Showing the Ribbon
Application.ExecuteExcel4Macro("SHOW.TOOLBAR("Ribbon","Visible")")



Globals Class

You can access the Ribbon from the Globals class.
Make sure that the tabs have unique IDs.



Office 2010

Dim objRibbonTab As Microsoft.Office.Tools.Ribbon.RibbonTab 
objRibbon.Activate


There are ActivateTab and ActivateTabMso methods

ribbon.ActivateTab "TabAddIns"; 
this.RibbonUI.ActivateTabMso("TabAddIns");


ribbon.ActivateTabQ - this is used for tabs shared between multiple add-ins 

This also requires an additional string parameter that specifies the namespace of the add-in


Office 2007

Using SendKeys


Using Microsoft Active Accessibility API
This is a COM based technology which provides the IAccessible interface
MSAA is a legacy API that was introduced in Windows 95
Microsoft UI Automation is the new accessibility model for Windows
Knowledge Base Article (2494267)



Copyright © 2001 - 2016 Better Solutions Limited | All Rights Reserved.    Previous

    Next