如何将自定义控件添加到 ms-access VBE 加载项中的菜单栏?

How to add a custom control to a menubar in an ms-access VBE-Add-in?

我用 C# 为 VBA-MS Aaccess 编辑器编写了一个插件

我已经创建了一个这样的工具栏:

var toolbar = m_VBE.CommandBars.Add(RadToolbarCaption, MsoBarPosition.msoBarTop, System.Type.Missing, true);

由于我需要在工具栏中使用更复杂的控件(内部带有图标的下拉列表),所以我考虑向工具栏添加自定义控件。这是我试过的:

try
{
    var crtl = m_toolbar.Controls.Add(MsoControlType.msoControlCustom);
}
catch (Exception ex)
{
    Debug.WriteLine(ex.Message);
}   

但是这个 returns 一个 ArgumentException:

Value outside of the valid range (Original: "Der Wert liegt außerhalb des erwarteten Bereichs.")

有没有办法向菜单栏添加除少数标准控件之外的控件?

不,不能在 Office CommandBar 对象中使用非标准控件。