从命令栏中删除一个子菜单
我在我的数据表上创build了excel vba中的一个子菜单。 这里是代码,
Set cbut = Application.CommandBars("List Range Popup").Controls("Delete") With cbut.Controls.Add .Caption = "Now" End With
我的问题是,如何从“删除”命令栏删除名为“现在”的这个子菜单,而不是删除“删除”命令栏?
那么使用object variable
呢?
(解决scheme未经testing,而是下面的伪代码)
dim subButton as commandbarbutton 'or any other set subbutton = cbut.controls.add with subbutton .caption = "now" end with '.... other actions subbutton.delete
它应该是:
Application.CommandBars("List Range Popup").Controls("Delete").Controls("Now").Delete