如何使动态菜单在功能区上执行多选

问题描述 投票:0回答:2

下面的代码创建带复选框的动态菜单。每次用户必须选择菜单以选择项目。我想避免这种情况,只在nenu上点击一次。

这里是xml

<dynamicMenu id="MnuSelectOtherDB"
             label="Select Other Databases"
             getContent="GetContentCallback"/>

这里是VBA代码

Sub GetContentCallback(control As IRibbonControl, _
                       ByRef XMLString)
    ' Callback get the selected datbases

    Dim lngDummy    As Long
    Dim strDummy    As String
    Dim strContent  As String
    strDummy = "<menu xmlns=""http://schemas.microsoft"
    strDummy = strDummy & ".com/office/2006/01/customui"">"

        For lngDummy = 0 To 5
            strContent = strContent & _
            "<checkBox id=""MyDynaCheckbox" & lngDummy & _
            """ label =""Dynamic Item" & _
            lngDummy & """/>"
        Next

    strDummy = strDummy & strContent & " </menu>"
    XMLString = strDummy
End Sub

这里是截屏

enter image description here

这里Dynamic menu on ribbon问题的视频

vba ms-access-2010 ribbon-control
2个回答
0
投票

据Cindy说,色带控制不允许它。现在不可能!


0
投票

你可以尝试Sendkey重新扩展菜单

    ' for my case ALT + Y2 then Y4 is shortcut key to activate element of CustomUI element
    Application.SendKeys ("%Y2Y4")
© www.soinside.com 2019 - 2024. All rights reserved.