To develop an add-in application for Microsoft Office, one of the largest difficulties is developing the automation for the new User Interface (UI) engine ribbon controls that was introduced in Office 2007. The COM object model for Office does not provide any properties or functions to collect the ribbon information and invoke the functionalities for the ribbon controls.
This article describes an All-In-One Code Framework sample that contains the CSOfficeRibbonAccessibility and VBOfficeRibbonAccessibility projects. This code sample demonstrates how to call a Microsoft Active Accessibility API to develop automation for Office ribbon controls. The Active Accessibility API refers to the native constants and functions that are exposed in the oleacc.dll library. To call these APIs from .NET, you need to adopt Platform Invoke Technology.
Difficulty level

Download information
To download this code sample, click one of the following links:
Technology category
- Office Solution Development
Languages
This code sample contains the following programming languages:
Language | Project Name |
---|---|
Visual C# | CSOfficeRibbonAccessibility |
Visual Basic.NET | VOfficeRibbonAccessibility |
Prerequisites
To run this sample code, you must have Microsoft Visual Studio 2010 and Microsoft Office 2010 installed. Or, you must have Microsoft Visual Studio 2007 and Microsoft Office 2007 installed.
Project usage
To use the sample project, follow these steps:
- Compile the Visual Studio Tools for Office (VSTO) project by using Microsoft Visual Studio 2007 or Microsoft Visual Studio 2010.
- Open Microsoft Word 2007 or Microsoft Word 2010. A Show Ribbon Information button is displayed on the Add-Ins tab.
- Click the Show Ribbon Information button. A form will pop up.
- In the first list box on the form, you can see all visible ribbon tabs. For example, you can see the Home, Insert, and PageLayout ribbon tabs.
- Click one of the ribbon tabs to navigate to it.
- Click the See children groups button. All groups of the selected tab will fill into the second list box.
- Click the See children controls button. All controls of the selected group will fill into the third list box.
- Click the Execute selected control button. This button invokes the functions for the selected control.