如何在功能区中执行commandID?

问题描述:

在旧版本的Office VBA中,我可以创建一个命令栏,对其进行控制,然后执行控件,如下所示:

In old versions of Office VBA I could create a commandbar, put a control on it, and execute the control, like this:

     ;    '使用触发标记的按钮创建一个临时命令栏,用于后续对话框

       设置TempBar = CommandBars.Add(名称:=" FlagDialog")

        '
$
        '将后续命令的标记放在TempBar临时工具栏上。
        Application.CommandBars(" FlagDialog")。Controls.Add Type:= msoControlButton,Id:= 8476,Before:= 1

        '
$
        '点击临时命令栏上的按钮,显示后续对话框的标志。
        Application.CommandBars(" FlagDialog")。Controls(1).Exec

        'Make a temporary commandbar with the button that fires the flag for followup dialog
        Set TempBar = CommandBars.Add(Name:="FlagDialog")
        '
        'Put the flag for followup command onto the TempBar temporary toolbar
        Application.CommandBars("FlagDialog").Controls.Add Type:=msoControlButton, Id:=8476, Before:=1
        '
        'Click the button on the temporary commandbar to display the flag for follow-up dialog
        Application.CommandBars("FlagDialog").Controls(1).Exec

使用功能区,是否有相同的方法来添加commandID并执行它?

Using the Ribbon, is there an equivalent way to add a commandID and execute it?

Mac MVP

嗨Jim,

你是什么意思添加一个commandID?什么是commandID?是 CommandID常量还是

CommandID类
还是其他什么?

What do you mean adding a commandID? What's the commandID? Is it CommandID Constants or CommandID Class or anything others?

最好的问候,

Terry