Prasanta Kumar
Prasanta Kumar

Reputation: 39

verify if a outlook ribbon control is enabled or not

I am working on outlook add ins. I have to check if outlook ribbon button (idmso = "EncryptMessage") is enabled or not.

I tried to solve by using commandbars.GetEnabledMso("idmso")

https://msdn.microsoft.com/EN-US/library/office/ff862202(v=office.14).aspx

but for outlook the real challenge I am facing is to get command bars object.

https://msdn.microsoft.com/en-us/library/office/ff865324(v=office.14).aspx

Please let me know the solution to resolve the issue.

Upvotes: 0

Views: 164

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66286

You can try to use Accessibility API to find the button on the Inspector ribbon and check if it is enabled.

If using Redemption is an option (I am its author), it exposes the ribbon and its control though the SafeInspector object

set sInspector = CreateObject("Redemption.SafeInspector")
sInspector.Item = Application.ActiveInspector
set Ribbon =  sInspector.Ribbon
oldActiveTab = Ribbon.ActiveTab
Ribbon.ActiveTab = "Options"
set Control = Ribbon.Controls("Encrypt")
MsgBox Control.Enabled
Ribbon.ActiveTab = oldActiveTab 'restore the active tab

Upvotes: 0

Related Questions