I am working on a C# Office COM Addin that has an adjoining form region that is associated with the Appointment message class. I am trying to open the Recurrence toggle button on the ribbon through code. I've tried Office.CommandBars interface and FindControl() to reference the control through its control id. But it does not work. Any help will be appreciated. Thanks in advance.
Asked
Active
Viewed 804 times
2 Answers
1
There is no need to use Accessibility API or Redemption in that case.
The ExecuteMso method of the Command bars class allows to execute built-in controls on the Ribbon. Try to use the following code while the Recurrence toggle button is displayed on the ribbon:
commandBars.ExecuteMso("Recurrence");
The command bars object should come from the Explorer or Inspector objects, depends on where the target control come from. See Office 2013 Help Files: Office Fluent User Interface Control Identifiers for more IdMso values.

Eugene Astafiev
- 47,483
- 3
- 24
- 45
-
Worked like a charm! Thank you! – Insane Jan 19 '15 at 05:41
0
You can try to use the accessibility API to simulate a click on the Recurrence button.
You can also try to use Redemption (I am its author) and its SafeInspector object to do that:
'simulate a click on the Recurrence button
set sInspector = CreateObject("Redemption.SafeInspector")
sInspector.Item = Application.ActiveInspector
set Ribbon = sInspector.Ribbon
oldActiveTab = Ribbon.ActiveTab
Ribbon.ActiveTab = "Appointment"
set Control = Ribbon.Controls("Recurrence...")
Control.Execute
Ribbon.ActiveTab = oldActiveTab 'restore the active tab

Dmitry Streblechenko
- 62,942
- 4
- 53
- 78