Search code examples
vbaribbonx

Tristate checkbox in Office ribbon


Is there a way to have a tri-state checkbox on MS office 2016 ribbons?


Solution

  • Nope. The Fluent UI has a limited number of controls with a pre-defined functionality. You can find all the ribbon UI controls described in the following articles:

    The checkBox control provides the getPressed callback which returns boolean:

    C#: bool GetPressed(IRibbonControl control)
    VBA: Sub GetPressed(control As IRibbonControl, ByRef returnValue)
    C++: HRESULT GetPressed([in] IRibbonControl *pControl, [out, retval] VARIANT_BOOL *pvarfPressed)
    Visual Basic: Function GetPressed(control As IRibbonControl) As Boolean
    

    There is no third state.